I've followed the steps at https://cloud.google.com/sql/docs/mysql/connect-kubernetes-engine to set up MySQL user accounts and service accounts. I've downloaded the JSON file containing my credentials.
My issue is that in the code I copied from the site:
- name: cloudsql-proxy
image: gcr.io/cloudsql-docker/gce-proxy:1.11
command: ["/cloud_sql_proxy",
"-instances=<INSTANCE_CONNECTION_NAME>=tcp:3306",
"-credential_file=/secrets/cloudsql/credentials.json"]
securityContext:
runAsUser: 2 # non-root user
allowPrivilegeEscalation: false
volumeMounts:
- name: cloudsql-instance-credentials
mountPath: /secrets/cloudsql
readOnly: true
the path /secrets/cloudsql/credentials.json is specified and I have no idea where it's coming from.
I think I'm supposed to create the credentials as a secret via
kubectl create secret generic cloudsql-instance-credentials --from-file=k8s\secrets\my-credentials.json
But after that I have no idea what to do. How does this secret become the path /secrets/cloudsql/credentials.json
?