Search code examples
google-cloud-sqlcloud-sql-proxy

instanceDoesNotExist after upgrading cloudsql-proxy to v1.31.0


I'm using Mac m1 machine and I wanted to upgrade to v 1.31.0 which make cloud-proxy ARM friendly. Here is a sample of my proxy file(which was working fine with the previous cloudsql-proxy versions)

    apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: db-proxy
  name: db-proxy
spec:
  replicas: 1
  selector:
    matchLabels:
      app: db-proxy
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: db-proxy
      name: db-proxy
    spec:
      containers:
      - command:
        - /cloud_sql_proxy
        - --dir=/cloudsql
        - -instances= ...some instances here
        - -credential_file=...file path
        image: gcr.io/cloudsql-docker/gce-proxy:1.31.0
        imagePullPolicy: IfNotPresent
        name: cloudsql-proxy
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /credentials
          name: db-proxy-credentials
          readOnly: true
        - mountPath: /etc/ssl/certs
          name: ssl-certs
        - mountPath: /cloudsql
          name: cloudsql
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      volumes:
      - name: db-proxy-credentials
        hostPath:
          path: ...
          type: Directory
      - hostPath:
          path: /etc/ssl/certs
          type: ""
        name: ssl-certs
      - emptyDir: {}
        name: cloudsql

And this is the error that i'm getting while starting the pod

googleapi: Error 404: The Cloud SQL instance does not exist., instanceDoesNotExist

Solution

  • 404 error appears because of the wrong naming of the Cloud SQL instances or if the instance doesn't exist. The older version of Cloud SQL Auth proxy doesn't crash the pod if the instance is not there, but the latest version does and hence the error. @Omar Ahmed confirmed the issue was solved by reviewing the instance names.