Mohamed Ayman:
Hi Dear,
Kindly check the example below for more explanation:
In Kubernetes there are different strategies for deployment such as Recreate and RollingUpdate which mentioned at the beginning of the <https://www.udemy.com/course/learn-kubernetes/learn/lecture/9723240|lecture 34https://www.udemy.com/course/learn-kubernetes/learn/lecture/9723240> .
If you don’t assign the strategy it will be by default the RollingUpdate and you can see the default properties of it by excuting the following command: kubectl edit deployment/mywebapp-deployment
and this is a snippet from the output :
RollingUpdate strategy deployment ensures that only a certain number of Pods are down while they are being updated. By default, it ensures that at least 75% of the desired number of Pods are up (25% max unavailable).
The deployment also ensures that only a certain number of Pods are created above the desired number of Pods. By default, it ensures that at most 125% of the desired number of Pods are up (25% max surge).
so in our example, It makes sure that at least 5 Pods are available and that at max 8 Pods in total are available.
As a result of that: during the update process, it terminated one pod as 25% max unavailable equals 1 and create only three pods then stuck as it reached 125% of the desired number of pods which equals 8 and can’t create more pods.
Reference : https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
mike sky:
hi @Mohamed Ayman, problem is that I added values in the YAML file. there is no error when executing it. But values were not configured as they are in YAML file.
In configuration, “strategy” is configured twice and deployment is considering last one. That means it is considering “strategy: {}”. Deployment considering by-default rolling update strategy with default parameters.
RollingUpdateStrategy: 25% max unavailable, 25% max surge
If you change order of “strategy” field in yaml configuration then deployment consider “maxSurge” & “maxUnavailable” value which you have mentioned.