How to ensure that at least 3 pods are always running even if there are any rolling updates in Kubernetes

Viewed 43

I have deployed an application in k8s cluster with 8 replicas. but how to ensure that there will be at least 3 pods always running during rolling update, can anyone please suggest a solution ?

Thanks in advance.

2 Answers

you can set the required values on maxSurge and maxUnavailable

  strategy:
    rollingUpdate:
       maxSurge: 25%
       maxUnavailable: 50%
    type: RollingUpdate

setting maxUnavailable to 50% will make sure that you always have 4 pods running.

Related