You have a production database running in Cloud SQL and an OpenShift cluster full of apps that need it. Theoretically, it should be simple. One command to connect, one policy to approve. Instead, you end up juggling service accounts, SSL certificates, and network rules that read like a puzzle written by a paranoid sysadmin.
Cloud SQL and OpenShift each solve big problems. Cloud SQL keeps your database managed and secure without the pain of patching or backups. OpenShift gives you a consistent platform for deploying containers with enterprise-grade control. The fun begins when you try to make them shake hands safely, repeatedly, and without breaking your CI/CD flow.
The integration hinges on identity. OpenShift runs your workloads under pods, often using Kubernetes service accounts. Cloud SQL expects an IAM principal or a secure proxy token. The goal is to line them up so that your app gets database access only if it’s running in the right cluster and namespace, not just because someone remembered a password.
How Cloud SQL connects to OpenShift
The logical path looks like this: an application pod connects through a secure sidecar or proxy that uses IAM credentials, often OAuth 2.0 or OIDC tokens, to prove who it is. Access is granted based on roles mapped in Cloud SQL IAM rather than stored secrets. This keeps credentials out of your image and lets rotation happen automatically. Once set up, developers deploy without copying environment variables or managing certificate files at 2 a.m.
Best practices that keep things sane
- Use workload identity wherever possible instead of static secrets.
- Map OpenShift service accounts to Cloud SQL IAM roles with the principle of least privilege.
- Rotate secrets automatically using native controllers or identity brokers.
- Keep connection policies defined in version control, not tribal memory.
The payoff is immediate. Your pipelines stop failing due to stale keys. Access requests vanish because the policy is already baked into your infrastructure. Logs show exactly which pod touched which database, satisfying both your auditors and your curiosity.