GithubHelp home page GithubHelp logo

How can I ensure cloud-sql-proxy sidecar container is running before other containers connecting to cloudsql from k8s? about cloud-sql-proxy HOT 4 CLOSED

chardch avatar chardch commented on June 27, 2024
How can I ensure cloud-sql-proxy sidecar container is running before other containers connecting to cloudsql from k8s?

from cloud-sql-proxy.

Comments (4)

chardch avatar chardch commented on June 27, 2024 1

Got it, thank you for this info! The wait command is exactly what I was looking for.

from cloud-sql-proxy.

jackwotherspoon avatar jackwotherspoon commented on June 27, 2024

We recently added support for a wait command #2041 and I think it is what you are looking for.

To help ensure the Proxy is up and ready, this commit adds a wait command with an optional --max flag to set the maximum time to wait.

By default when invoking this command:

./cloud-sql-proxy wait

The Proxy will wait up to the maximum time for the /startup endpoint to respond. This command requires that the Proxy be started in another process with the HTTP health check enabled. If an alternate health check port or address is used, as in:

./cloud-sql-proxy <INSTANCE_CONNECTION_NAME> \
  --http-address 0.0.0.0 \
  --http-port 9191

Then the wait command must also be told to use the same custom values:

./cloud-sql-proxy wait \
  --http-address 0.0.0.0 \
  --http-port 9191

By default the wait command will wait 30 seconds. To alter this value, use:

./cloud-sql-proxy wait --max 10s

@chardch does that work for your use-case?

from cloud-sql-proxy.

enocom avatar enocom commented on June 27, 2024

This works in combination with a poststart hook. Context: https://medium.com/@marko.luksa/delaying-application-start-until-sidecar-is-ready-2ec2d21a7b74

from cloud-sql-proxy.

enocom avatar enocom commented on June 27, 2024

Going to close this. Feel free to reopen if you’re still stuck on this.

from cloud-sql-proxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.