-
Notifications
You must be signed in to change notification settings - Fork 349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I ensure cloud-sql-proxy sidecar container is running before other containers connecting to cloudsql from k8s? #2063
Comments
We recently added support for a
@chardch does that work for your use-case? |
This works in combination with a poststart hook. Context: https://medium.com/@marko.luksa/delaying-application-start-until-sidecar-is-ready-2ec2d21a7b74 |
Going to close this. Feel free to reopen if you’re still stuck on this. |
Got it, thank you for this info! The wait command is exactly what I was looking for. |
For anyone coming here, please note that you'll also have to pass |
Hi @enocom, I was wondering if you could share how it should work with a Version: lifecycle:
postStart:
exec:
command:
- /bin/sh
- -c
- ./cloud-sql-proxy wait --http-address 0.0.0.0 --http-port XXXX also tried postStart:
exec:
command:
- /cloud_sql_proxy
- wait
- --http-address
- 0.0.0.0
- --http-port │
- "XXXX" and just postStart:
exec:
command:
- wait On the above ⬆️ also tried with and without the 2 flags: and I set the right envs (I believe): env: │ │
│ - name: CSQL_PROXY_HEALTH_CHECK │
│ value: "true" │
│ - name: CSQL_PROXY_HTTP_PORT │
│ value: "XXXX" │
│ - name: CSQL_PROXY_HTTP_ADDRESS │
│ value: 0.0.0.0 │
│ - name: CSQL_PROXY_EXIT_ZERO_ON_SIGTERM │
│ value: "true" │
│ - name: CSQL_PROXY_STRUCTURED_LOGS │
│ value: "true" And I keep getting a EDIT: was obviously the command flags that weren't set properly 🤦 thanks anyways! |
@joaoviana Could you perhaps share the implementation of the setup that was successful for you? It's unclear to me what your final k8s post start hook exactly looks like and would be very grateful If you'd be able to share that. Or would you perhaps be able to provide a working example @enocom ? |
yes please post what you got working! @joaoviana |
Take a look at #128 (comment) -- that uses the new sidecar containers. #2063 (comment) would be another good option if you can't use the new feature. |
Question
I have a k8s pod with 2 containers
I want the cloud-sql-proxy to start running before the container connecting to my cloudsql instance. I experimented with using
lifecycle.postStart
in the cloud-sql-proxy container spec, but the container image doesn't seem to include any commands I can viably use to ensure other containers start after it.This must be a common desired behavior, so is there any suggestion here?
Code
No response
Additional Details
No response
The text was updated successfully, but these errors were encountered: