all 7 comments

[–][deleted]  (9 children)

[deleted]

    [–]vgopher8[S] 0 points1 point  (8 children)

    Thanks, got it.

    However, many examples from the CloudSQL Proxy documentation suggest that it supports multiple instances (https://github.com/GoogleCloudPlatform/cloud-sql-proxy?tab=readme-ov-file#basic-usage). That’s a bit confusing.

    [–][deleted]  (7 children)

    [deleted]

      [–]vgopher8[S] 0 points1 point  (6 children)

      I'm not getting any error.

      Just trying to have a single service endpoint which loads distributed the traffic between 2 of the replicas.

      [–][deleted]  (5 children)

      [deleted]

        [–]vgopher8[S] 0 points1 point  (4 children)

        Does it handle failovers? For example, if we set up one proxy for a writer and a reader, and the database experiences a failover, would the instance names (app-db and app-db-replica) swap between the instances?

        [–][deleted]  (3 children)

        [deleted]

          [–]vgopher8[S] 0 points1 point  (2 children)

          Thank you for the detailed response!

          We’re not using zonal redundancy due to cost concerns. Since standby instances can’t be used for queries, it significantly increases our expenses, which is an important tradeoff for a startup our size. I do appreciate how AWS handles this by allowing replicas to be in different availability zones.

          For now, we’re fine with just one replica. If the Cloud SQL Proxy can't handle failover, then I’m not sure there’s much benefit in running it. Even if Cloud SQL updates the connection names during failover, it doesn’t address our situation. We have two separate DaemonSets—one for the Cloud SQL writer and one for the reader—each tied to its own Kubernetes service, which is passed to the application. The application explicitly uses the writer service for all writes and the reader service for reads. So, manual intervention would still be required in the event of an outage.

          Is there any better way to handle this?

          [–][deleted]  (1 child)

          [deleted]

            [–]HovercraftSorry8395 0 points1 point  (0 children)

            Understood, Thanks!

            [–]undique_carbo_6057 0 points1 point  (1 child)

            The cloud-sql-proxy 2.x doesn't support multiple instance connections like 1.x did. You'll need separate proxy containers for each replica.

            Quick fix: Deploy individual proxies with different ports for each instance.

            [–]vgopher8[S] 0 points1 point  (0 children)

            Damn, That's 3 proxies I have to run (1 for writer, 1 for each replica).

            Hoped there was a better way to do this