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

Published
Length
3 min read

Luis Felipe Dias

All posts

Pairing cloud sql and linstor lets teams run managed databases alongside fast block storage in production. This setup separates relational state in Google Cloud from local cluster volumes. Many teams store core user records in the managed database. They keep local state, caches, or worker files on block volumes. Getting both tools to work together requires clear rules for identity and network paths. When you align these pieces, your apps read and write data without leaks. How permissions and

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 linstor lets teams run managed databases alongside fast block storage in production. This setup separates relational state in Google Cloud from local cluster volumes.

Many teams store core user records in the managed database. They keep local state, caches, or worker files on block volumes. Getting both tools to work together requires clear rules for identity and network paths. When you align these pieces, your apps read and write data without leaks.

How permissions and data flow in cloud sql and linstor

In this setup, your cluster apps talk to both storage systems at once. Linstor manages persistent block volumes across your compute nodes. The managed database holds shared relational tables that every node needs to read.

Or you might store Linstor controller state inside a managed SQL database. Both patterns need strict login rules and clear role limits. Cloud SQL for PostgreSQL is a managed service with distinct role limits. Customers cannot create or use database accounts with full superuser attributes.

Instead, you assign the cloudsqlsuperuser role to your main admin accounts. This role gives some high privileges, like creating extensions or event triggers. It also lets you create replication users, publications, and subscriptions.

The default postgres admin user belongs to this cloudsqlsuperuser group. That default user starts without a password, so you must set one before logging in. It holds role creation, database creation, and login rights, but lacks superuser or replication attributes.

A Google system account named cloudsqladmin holds the actual superuser rights on the instance. Customers cannot delete or change these built-in system roles or users. When your storage controller or app logs in, it should use a custom role with limited rights.

Common failure modes and how to scope roles

Teams often take shortcuts when linking cluster workloads to a managed database. The most common mistake is sharing one admin account across all nodes. If every node uses the default postgres user, you lose track of who ran which query.

Broad credentials also raise the risk of accidental table drops during volume migrations. Another failure mode is leaving network paths open between all cluster nodes and the database. Worker nodes that only mount block volumes rarely need direct database access.

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 a third major gap for operations teams. When a storage sync job fails, you need to see the exact query and user identity. Shared service accounts hide which pod or engineer triggered a bad write.

To fix this, give each service its own database user with strict table permissions. Never run app workloads or storage controllers under the cloudsqlsuperuser role. Reserve that role for setup tasks like adding extensions or setting up replication.

Next, lock down network routes so only specific pods can reach the database port. Keep your block storage replication traffic on its own private network link. If engineers run manual checks on database tables, apply data masking to protect sensitive columns. Masking rewrites matched fields like emails, phone numbers, card numbers, or national IDs in query results.

Auditing storage and database changes across teams

Running two storage layers means two places where config drift can happen. A developer might change a table schema while an operator resizes a block volume. If these changes happen without a shared log, debugging takes hours.

You should require individual logins for every human who touches either system. Map each engineer to their own identity rather than handing out shared passwords. When everyone logs in with a personal role, your audit logs stay clean and useful.

Review your database roles every month to remove unused accounts. Check that no app user holds role creation or database creation rights by mistake. Clear boundaries between block storage ops and database ops keep production stable.

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 I use a full superuser account to connect my cluster apps to Cloud SQL?

No, customers cannot create or access users with true superuser attributes in Cloud SQL for PostgreSQL. You can use the cloudsqlsuperuser role for admin tasks, while the system account cloudsqladmin holds real superuser rights.

Should the Linstor controller use the default postgres user?

No, you should create a dedicated user with rights limited to its specific database. Keep the default postgres user and the cloudsqlsuperuser role for manual setup and admin work only.

How do we protect sensitive user data during database checks?

Give engineers read-only roles and turn on data masking for sensitive columns. Masking rewrites fields like emails, phone numbers, card numbers, and national IDs in the results.

Short role checks help teams work fast. Simple rules make each review clear. Good logs keep every team safe. Scoped keys stop bad changes early.

The query runs. The emails stay hidden.