I created a private CloudSQL instance for a postgres db. I followed the documentation at https://cloud.google.com/sql/docs/postgres/connect-kubernetes-engine and applied the yaml changes and restarted the deployment. Added the below to my existing Yaml for deployment. I was wondering if there is any way to test/check if the connection to the DB was successful. EDIT - I didnt encounter any errors when the pod restarted, so thats the main reason I am asking this question.
spec:
containers:
- name: <YOUR-APPLICATION-NAME>
# ... other container configuration
env:
- name: DB_USER
valueFrom:
secretKeyRef:
name: <YOUR-DB-SECRET>
key: username
- name: DB_PASS
valueFrom:
secretKeyRef:
name: <YOUR-DB-SECRET>
key: password
- name: DB_NAME
valueFrom:
secretKeyRef:
name: <YOUR-DB-SECRET>
key: database
- name: DB_HOST
valueFrom:
secretKeyRef:
name: <YOUR-PRIVATE-IP-SECRET>
key: db_host