zero_yu
zero_yu

Reputation: 503

Configure k8s to stop accepting requests at the older pods once at least the minimum expected amount of newer pods are available

With the rolling updates, for example if the image version needs to be updated, do we have the option to configure k8s to stop accepting requests at the older pods once at least the minimum expected amount of newer pods are available? Thanks.

Upvotes: 0

Views: 421

Answers (2)

Matt
Matt

Reputation: 74620

I'm not aware of a way to have kubernetes manage that specific deployment itself without writing custom kubectl client or kubernetes controller logic (see related questions in the sidebar).

But from the brief description the steps don't seem too hard to implement via a couple of extra API calls:

  1. Scale old release to lower limit
  2. Rollout update
  3. Scale new release to upper limit

For a good overview of some custom deployment methods managed outside of kubernetes have a look at the Container Solution deployment strategy guide. Maybe the blue/green deployment fits better.

Upvotes: 2

Sam-T
Sam-T

Reputation: 1965

Kubernetes will start using the new pod as soon as it becomes available (you can implement readiness probe for better experience w/o rolling updates). Also simultaneously, Kubernetes will start killing the old pods. You can specify maxUnavailable is an optional field that specifies the maximum number of Pods that can be unavailable during the update process. Also maxSurge is an optional field that specifies the maximum number of Pods that can be created over the desired number of Pods.

Nonetheless, there is nothing like stop using old pods (if they still exist) after certain % of new pods are available. You can potentially code/configure something - not sure.

Upvotes: 0

Related Questions