How do you deploy a feature with zero downtime in Kubernetes?
kubectl run nginx --image=nginx # creates a deployment ○ → kubectl get deploy NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE nginx 1 1 1 0 7s Now let’s assume we are going to update the nginx image
kubectl set image deployment nginx nginx=nginx:1.15 # updates the image Now when we check the replica sets
kubectl get replicasets # get replica sets NAME DESIRED CURRENT READY AGE nginx-65899c769f 0 0 0 7m nginx-6c9655f5bb 1 1 1 13s From the above, we can notice that one more replica set was added and then the other replica set was brought down
kubectl rollout status deployment nginx
check the status of a deployment rollout
kubectl rollout history deployment nginx
check the revisions in a deployment
○ → kubectl rollout history deployment nginx deployment.extensions/nginx REVISION CHANGE-CAUSE 1 2
CodePudding user response:
You should use strategy as rolling update with max surge and max unavailable defined
for morer information go here https://kubernetes.io/docs/concepts/workloads/controllers/deployment/