1

I maintain an application that has occasional problems caused by races during start up but need multiple instances running. Is it possible to limit the number of pods kubernettes brings up at the same time?

e.g. if it's configured to have 3 replicas and 2 of them are down, can I make sure it doesn't start two pods at the same time and instead wait for liveliness check to pass on the first new pod before starting the second one?

1
  • I guess the best bet would be using an init-container checking the state of the deployment. But the best case would be to fix the application itself.
    – Tensibai
    Commented Dec 21, 2022 at 16:21

1 Answer 1

0

If you use a hpa to increase the deployment from zero to e.g. 3 replicas, you can set the scaling behaviour to limit it to say one new pod per 60 seconds. However, this won’t affect how quickly pods or containers are restarted if they crash at the same time.

Would definitely consider implementing some form of semaphore inside your image, to wrap the problematic process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.