简体   繁体   中英

Kubernetes Deployment Rolling Update

I have an application that I deploy on Kubernetes.

This application has 5 replicas and I'm doing a rolling update on each deployment.

This application has a graceful shutdown which can take tens of minutes (it has to wait for running tasks to finish).

My problem is that during updates,all the older version pods are stuck at "Terminating" status while all the new pods are created.

During the updates, I end up running with 8 containers and it is something I'm trying to avoid.

The behaviour I'm trying to get is that new pods will only get created after the old version pods terminated successfully, so at all times I'm not exceeding the number of replicas I set.

I wonder if there is a way to achieve such behaviour.

set maxSurge to 5, so the number of all pods (both terminating and creating) will not exceed 5.

I think the best way to achieve this goal is to use Statefulsets , some of the key features of Statefulsets are:

  • Ordered, automated rolling updates.
  • Ordered, graceful deployment and scaling.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM