apiVersion: apps/v1
kind: Deployment
metadata:
  name: sql-proxy-deployment
  labels:
    app: sql-proxy
spec:
  replicas: 1
  selector:
    matchLabels:
      app: sql-proxy
  template:
    metadata:
      labels:
        app: sql-proxy
    spec:
      containers:
      - name: sql-proxy
        image: gcr.io/cloudsql-docker/gce-proxy:1.22.0
        command: ["/cloud_sql_proxy",
                  "-instances=<CHANGE_DB_CONNECTION>=tcp:0.0.0.0:3306",
                  "-credential_file=/secrets/cloudsql/service_account.json"]
        volumeMounts:
        - name: cloudsql-instance-credentials
          mountPath: /secrets/cloudsql
          readOnly: true
      volumes:
      - name: cloudsql-instance-credentials
        secret:
          secretName: my-cloud-sql-secret