The Simplest Way to Make Cloud SQL and Kuma Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Pairing cloud sql and kuma lets teams control service traffic to managed databases. Kuma routes mesh traffic while Cloud SQL stores app data and checks user roles. Teams use this pair to connect microservices to relational data across clusters. Kuma handles service discovery, mutual TLS, and traffic rules between workloads. Cloud SQL runs the database engine and manages storage, backups, and user permissions. When they work together, apps reach their data through controlled mesh routes. How c

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.

Pairing cloud sql and kuma lets teams control service traffic to managed databases. Kuma routes mesh traffic while Cloud SQL stores app data and checks user roles.

Teams use this pair to connect microservices to relational data across clusters. Kuma handles service discovery, mutual TLS, and traffic rules between workloads. Cloud SQL runs the database engine and manages storage, backups, and user permissions. When they work together, apps reach their data through controlled mesh routes.

How cloud sql and kuma handle identity and data flow

Data flows from an app pod through its sidecar to the database instance. Kuma checks the service identity and applies traffic permissions inside the mesh. It encrypts traffic between services and records network metrics for every call. Once the traffic leaves the mesh, Cloud SQL takes over the login check.

Cloud SQL for PostgreSQL is a managed service with strict role limits. Customers cannot make or use accounts with full superuser attributes. Instead, Cloud SQL provides a custom admin role with specific high-level privileges. This role lets admins add extensions, event triggers, and replication users. A Google-managed system user holds the real superuser power on the instance. Customers cannot change or remove these built-in system roles.

The default admin user starts without a password, so you must set one first. This default user can create roles, create databases, and log in. It does not hold full superuser or replication attributes on the server. When a mesh service connects, it logs in as a database user. Cloud SQL checks those credentials and enforces table permissions for every query.

Common failure modes and how to scope roles

A common mistake is sharing one admin account across many mesh services. Teams often put the default admin credentials into several app deployments. If one service has a bug, it can drop tables or read everything. Another problem is using broad mesh rules that let any pod reach the database. Network logs in Kuma only show service traffic, not the SQL statements run.

To fix this, give each service its own database user with narrow rights. Use the default admin user only to create smaller roles and databases. Grant each app role only the read or write access it needs. Do not give app workloads the custom admin role in production.

End-to-End Encryption + SQL Query Filtering: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Next, lock down the network path inside Kuma. Write traffic rules so only specific backend services can reach the database address. Block front-end pods and batch jobs that do not need direct database access. Combine tight mesh routing with narrow database roles to reduce risk.

Keeping sensitive data safe during human access

Service-to-service traffic is only half of the database security picture. Engineers and support staff also run queries to fix bugs and check data. Mesh rules do not stop a logged-in user from reading sensitive columns. Production tables often hold emails, phone numbers, card numbers, and national IDs.

Teams should separate app service accounts from human login paths. Give engineers read-only roles when they inspect live data. Masking rules can also rewrite matched fields like card numbers in query results. This keeps raw emails and phone numbers safe during daily support work.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Does Kuma replace database roles in Cloud SQL?

No, Kuma only controls network traffic and service identity inside the mesh. You still need Cloud SQL roles to control who can read or change tables.

Can a mesh service use a full superuser account in Cloud SQL for PostgreSQL?

No, customers cannot create or use accounts with full superuser attributes in Cloud SQL. Apps should use standard roles with limited read and write grants.

How should we set up the default postgres user for mesh apps?

Set a password on the default postgres user and use it only for setup tasks. Create separate, smaller user accounts for each app running in Kuma.

The query runs. The emails stay hidden.