I have a simple example where I need multiple containers (deployments with replicas and jobs with replicas set to 1) to be able to connect to my mysql instance. I'm following the directions from this page:
https://cloud.google.com/sql/docs/mysql/connect-container-engine
I'm able to combine the app (wordpress) and job (logstash connected to mysql over jdbc) into a single deployment with the cloudsql-proxy sidecar and it works if I have replicas set to 1. If I increase replicas to 2 or more, only one of the sidecars will start (call it pod 1). The other errors off as follows:
Error from server (BadRequest): container "cloudsql-proxy" in pod "mysql-test-2203380987-cmkkf" is waiting to start: trying and failing to pull image
The sidecar in pod 1 works with no issues as do the other containers in pod 1, but the containers in pod 2 fail.
I also tried pulling the job out of the deployment, but I get the same errors. Then I simplified and have only a simple mysql connection (via mysql command line) with the sidecar in a deployment. If replicas is 1, it works fine. If replicas is 2, one of the testers and sidecars works, the other fails with the image pull issue above.
Why can't I have more than 1 proxy running to mysql? If I need multiple users defined, how would that work with replicated deployments?