Document using cloudsql auth proxy in kubernetes jobs
Question
I need to use this in a kubernetes job, While it works in the side car pattern, the job is stuck in NotReady status since the auth proxy never exit.
any way to trigger an exit code with status code that will make the job succeed?
Code
No response
Additional Details
No response
You can do this with two flags:
- --quitquitquit and
- --exit-zero-on-sigterm
With both in place, your main task has to call the /quitquitquit endpoint after your job is done and the Proxy will shutdown with a zero exit code.
This is a common enough use case, we'll make this issue about improving documentation about it.
Let me know if you have any other questions.
Hello, There will soon be a better piece of documentation on how to make this work correctly in the cloud-sql-proxy-operator project. See cloud-sql-proxy-operator#438.
I will add documentation to this project as well, for users who would rather configure side-car containers themselves.
I experienced a similar issue.
Upon completion, the main container shuts down and makes the recommended curl request (per the example).
The GET function was not working as expected. I was able to successfully shut down the proxy when updating to a POST:
curl -X POST -d '' http://localhost:9092/quitquitquit
This is described in the comments of the example .yaml if you read more closely. I am running gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.6.0 - maybe the GET works in later releases.
EDIT:
The GET is supported in 2.7: https://github.com/GoogleCloudPlatform/cloud-sql-proxy/blob/cc76a544a6878ad9f0ef5fb407de314b3f801cbe/CHANGELOG.md?plain=1#L15
Yes, GET support was released in 2.7.0.
https://github.com/GoogleCloudPlatform/cloud-sql-proxy/releases/tag/v2.7.0
Yes, GET support was released in 2.7.0.
https://github.com/GoogleCloudPlatform/cloud-sql-proxy/releases/tag/v2.7.0
Awesome, thank you! Appreciate all the hard work on the cloud-sql-proxy.