The Simplest Way to Make Cloud SQL and Openebs Work Like They Should
Teams pair cloud sql and openebs to run managed databases alongside Kubernetes block storage. This setup keeps core data in Google Cloud while local pods use attached volumes. Many clusters need both managed relational tables and fast local disk space. You can store user records in a managed database and keep cache files on nodes. Doing both well takes clear role limits and clean network paths. How cloud sql and openebs share data and roles In this setup, pods read from local volumes and wri
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Teams pair cloud sql and openebs to run managed databases alongside Kubernetes block storage. This setup keeps core data in Google Cloud while local pods use attached volumes.
Many clusters need both managed relational tables and fast local disk space. You can store user records in a managed database and keep cache files on nodes. Doing both well takes clear role limits and clean network paths.
How cloud sql and openebs share data and roles
In this setup, pods read from local volumes and write to managed database tables. Kubernetes workloads mount node storage for scratch data, queues, or local state. Those same pods open network sessions to the managed database for permanent records.
Database role setup works a bit different here than on self-hosted servers. Cloud SQL for PostgreSQL is a managed service. Because of this, you cannot make or use accounts with true superuser attributes. Google keeps true superuser rights on a system account that customers cannot change.
Instead, you grant the cloudsqlsuperuser role to your admin accounts. The default postgres account belongs to this role and can log in, create databases, and make new roles. It does not hold true superuser or replication attributes. You must set a password on the default postgres user before anyone logs in.
Your cluster apps should not use the default admin account for daily work. Create narrow database users for each service running on your storage nodes. Give those users rights to read or write only the tables they need. If a pod needs extensions, event triggers, or replication publications, use the cloudsqlsuperuser role during setup only.
Common failure modes and how to scope permissions
The biggest risk in this architecture is sharing one database account across many pods. Teams often put the default postgres user password into a shared cluster secret. When every pod uses that secret, your logs cannot show which workload ran a query.
Broad tokens and shared secrets also make incidents much worse. If one container with local storage gets compromised, the attacker gains broad database rights. They can drop tables or read sensitive rows from other services.
End-to-End Encryption + SQL Query Filtering: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Unlogged queries create another major blind spot for platform teams. When engineers debug local volume sync issues, they often open direct database sessions. If ten engineers log in with the same role, you lose all audit trails. You cannot tell who changed a row or ran a heavy read query.
To fix this, split accounts by workload and by person. Give each Kubernetes workload its own database user with strict table permissions. Never let app pods run with the cloudsqlsuperuser role in production. Lock down network paths so only specific namespaces can reach the database network address.
For human fixing, require personal accounts instead of shared admin keys. Also consider data privacy when engineers run checks against production tables. Data masking rewrites matched fields in results, such as emails, phone numbers, card numbers, or national IDs. This keeps sensitive values safe during live debugging sessions.
Keeping local volumes and managed tables in sync
Stateful pods often read rows from the managed database and write files to local disks. If a pod restarts or moves to a new node, storage must reattach cleanly. Meanwhile, the pod must drop stale database sessions and open fresh ones.
Set clear session timeouts on your database users so dead pods do not lock rows. Keep your storage classes scoped to the exact nodes that can reach the database subnet. When you pair narrow network rules with scoped roles, both storage systems run safely.
Add runtime guardrails and masking beside your databases and APIs
Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.
Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.
Frequently asked questions
Can my Kubernetes pods use a true PostgreSQL superuser in Cloud SQL?
No, customers cannot create or use accounts with true superuser attributes in this managed service. You can use the cloudsqlsuperuser role for tasks like adding extensions or setting up replication.
Should stateful workloads use the default postgres user to read and write data?
No, the default postgres user has broad rights to create roles and databases. Create a separate user with limited table permissions for each workload in your cluster.
How do we protect sensitive fields when engineers query the database during storage incidents?
Give each engineer an individual identity and apply field masking on query results. Masking rewrites fields like emails, phone numbers, and card numbers before returning the output.
Related guides
In this post