Hi All, I am using below yaml file but maxUnavailable and maxSurge parameters do . . .

mike sky:
Hi All, I am using below yaml file but maxUnavailable and maxSurge parameters don’t work. They remain at %25. Any idea?

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: mynginx
  name: mynginx
spec:
  replicas: 10
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
      minReadySeconds: 5
  selector:
    matchLabels:
      app: mynginx
  strategy: {}
  template:
    metadata:
      labels:
        app: mynginx
    spec:
      containers:
      - image: nginx
        name: nginx

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.