You need to update a Deployment's image from nginx:1.20 to nginx:1.21 using a rolling update strategy, but you want to ensure that during the update, at most 2 pods above the desired replicas (10) are running, and at least 8 pods are available at all times. Which strategy configuration should you apply?
Trap 1: maxSurge: 3, maxUnavailable: 2
maxSurge=3 allows up to 3 extra pods above the desired 10, violating the 'at most 2 pods above' constraint.
Trap 2: maxSurge: 3, maxUnavailable: 3
maxSurge=3 violates the extra pod limit, and maxUnavailable=3 would allow only 7 available pods (10-3=7), violating the 'at least 8 available' constraint.
Trap 3: maxSurge: '20%', maxUnavailable: '20%'
Correct. The 20% values translate to maxSurge=2 and maxUnavailable=2 for this replica count, meeting both constraints. In Kubernetes, percentage-based values are legally valid and equivalent to the integer values for this scenario.
- A
maxSurge: 3, maxUnavailable: 2
Why wrong: maxSurge=3 allows up to 3 extra pods above the desired 10, violating the 'at most 2 pods above' constraint.
- B
maxSurge: 3, maxUnavailable: 3
Why wrong: maxSurge=3 violates the extra pod limit, and maxUnavailable=3 would allow only 7 available pods (10-3=7), violating the 'at least 8 available' constraint.
- C
maxSurge: 2, maxUnavailable: 2
Correct. Integer values 2 and 2 directly satisfy both constraints.
- D
maxSurge: '20%', maxUnavailable: '20%'
Why wrong: Correct. The 20% values translate to maxSurge=2 and maxUnavailable=2 for this replica count, meeting both constraints. In Kubernetes, percentage-based values are legally valid and equivalent to the integer values for this scenario.