K8

GKE to Cloud SQL DSN & Connectivity Troubleshooter

Inspired by Shreya Sinha's Day 17 DevOps Blueprint

DSN Syntax Collision

1. Database Credentials & URI Parser

RFC 3986 Engine
postgresql://auth_app:My@Password123@10.128.0.3:5432/auth_db
Syntax Ambiguity Detected: Unescaped '@' at password index 2 causes URI parser to misidentify 'Password123@10.128.0.3' as hostname.

2. Architecture Topology & Diagnostics

Live GKE Simulator
GCP DEFAULT VPC NETWORK (us-central1) GKE Pod (Flask) signup-app-deploy IP: 10.128.1.14 DNS Hostname Failed Cloud SQL (PostgreSQL) Instance: auth_db Private IP: 10.128.0.3 Port: 5432
Subnet: 10.128.0.0/20 Private Service Access Enabled (Same VPC)
gcloud-cloudshell : gcp-gke
Source Rule Highlight (RFC 3986 ยง2.2):

When connection strings contain URI reserved delimiters such as @, :, /, or # within credentials, parsers like psycopg divide parameters at the delimiter. The character @ separates userinfo from the authority/host. Thus Password123@10.128.0.3 triggers psycopg.OperationalError: failed to resolve host : [Errno -2] Name or service not known. Fix by encoding @ as %40.