GCP Only: This configuration is specific to Google Cloud Platform. For other cloud providers, use native database connection methods with appropriate authentication.
Core Configuration
Enable Cloud SQL Auth Proxy sidecar containers.When Enabled:
- Proxy sidecar added to web, worker, OAuth, Wharf, and job pods
- Application connects to
127.0.0.1:<port>instead of Cloud SQL directly - Proxy handles authentication via Workload Identity or IAM tokens
- Connection is encrypted by the proxy
- Application must connect directly to Cloud SQL
- Requires network connectivity to Cloud SQL instance
- Must handle authentication via connection strings or environment variables
Cloud SQL instance connection name.Format: Example:
PROJECT_ID:REGION:INSTANCE_NAMERequired: Yes (when cloudSqlProxy.enabled: true)Example Values:my-project:us-central1:crewai-productionprod-123:europe-west1:postgres-maincompany-gcp:asia-east1:crewai-db
Local port where the proxy listens.Default:
5432 (PostgreSQL default)Purpose: Application containers connect to 127.0.0.1:<port> to reach Cloud SQL.Configuration:- Set
envVars.DB_HOST: "127.0.0.1" - Set
envVars.DB_PORT: "5432"(or your custom port)
Use private IP for Cloud SQL connection.When true:
- Proxy connects to Cloud SQL via private VPC IP
- Requires VPC peering or Private Service Connect
- More secure, no public internet exposure
- Lower latency (internal network)
- Proxy connects to Cloud SQL via public IP
- Requires Cloud SQL public IP enabled
- Connection still encrypted by proxy
- Can access from any network
true with VPC-peered Cloud SQL instances.Example:Enable IAM-based database authentication.When true:Example - Password Authentication:
- Proxy authenticates to Cloud SQL using IAM tokens
- No database password required
- Uses service account bound via Workload Identity
- Database user must be IAM-based (e.g.,
user@project.iam)
- Proxy establishes encrypted connection only
- Database authentication uses traditional username/password
- Requires
secrets.DB_PASSWORDto be set
- Cloud SQL instance has
cloudsql.iam_authentication=ondatabase flag - IAM database user created (e.g.,
gsa-name@project.iam) - Service account has
roles/cloudsql.instanceUserrole - SQL privileges granted to IAM user
See GCP Integration Guide - Cloud SQL IAM Authentication for detailed setup instructions.
Cloud SQL Auth Proxy container image.Default:
gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.14.3Version Updates: Check Cloud SQL Proxy Releases for latest versions.Production Recommendation: Pin to a specific version tag for reproducible deployments.Example:Resource Configuration
CPU and memory resource requests and limits for the proxy sidecar.Default Configuration:Purpose: The proxy is lightweight and handles connection management with minimal overhead.Tuning Guidelines:Low Traffic (< 50 connections):Medium Traffic (50-200 connections):High Traffic (200+ connections):
Complete Examples
Basic Cloud SQL Connection with IAM Authentication
Cloud SQL Connection with Password Authentication
Public IP Connection (No VPC Peering)
Troubleshooting
Connection Refused on 127.0.0.1
Symptoms: Application logs showcould not connect to server: Connection refused for 127.0.0.1:5432
Possible Causes:
- Cloud SQL Proxy sidecar not running
- Proxy failed to start due to authentication issues
- Port mismatch
IAM Authentication Failures
Symptoms:fe_sendauth: no password supplied or password authentication failed
Solutions:
-
“no password supplied” -
autoIamAuthnnot enabled: -
“password authentication failed” - IAM flag not enabled on Cloud SQL:
-
Missing IAM user:
Workload Identity Not Working
Symptoms: Proxy logs showcould not retrieve default credentials
Verify Workload Identity setup:
Proxy Can’t Reach Cloud SQL
Symptoms: Proxy logs showconnection refused or timeout when connecting to Cloud SQL
For Private IP (privateIp: true):
- Verify VPC peering is configured
- Check firewall rules allow GKE to Cloud SQL traffic
- Ensure Cloud SQL instance has private IP enabled
privateIp: false):
- Verify Cloud SQL instance has public IP enabled
- Check authorized networks if configured
