kubernetes: Deployment rolling update `maxSurge` and `maxUnavailable` not changed if I don't specify them
What happened?
I have and exists deployment,the first time I apply It with specifying the rollingUpdate like this
strategy:
rollingUpdate:
maxSurge: 100%
maxUnavailable: 20%
type: RollingUpdate
And then I modify the deployment’s yaml,remove the strategy Setting,according to the default,I think after re-apply the deployment,the maxSurge and maxUnavailable will change to 25%,but after apply I get the deployment with "-o yaml " option,they do not change. Still like this:
strategy:
rollingUpdate:
maxSurge: 100%
maxUnavailable: 20%
type: RollingUpdate
What did you expect to happen?
After modify the yaml and remove the strategy,and apply it, the deployment in cluster should change the maxSurge and maxUnavailable to 25% according to default.
How can we reproduce it (as minimally and precisely as possible)?
Deploy a deployment with strategy like this
strategy:
rollingUpdate:
maxSurge: 100%
maxUnavailable: 20%
type: RollingUpdate
then remove the strategy setting from the yaml and apply again
Anything else we need to know?
No response
Kubernetes version
Client Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.6", GitCommit:"b39bf148cd654599a52e867485c02c4f9d28b312", GitTreeState:"clean", BuildDate:"2022-09-21T13:19:24Z", GoVersion:"go1.18.6", Compiler:"gc", Platform:"darwin/amd64"}
Kustomize Version: v4.5.4
Server Version: version.Info{Major:"1", Minor:"24+", GitVersion:"v1.24.6-aliyun.1", GitCommit:"5296768e052ba56e92b5d5bf7b52d33973a34c6f", GitTreeState:"clean", BuildDate:"2023-04-19T06:36:28Z", GoVersion:"go1.18.6", Compiler:"gc", Platform:"linux/amd64"}
Cloud provider
ali cloud
OS version
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here
# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, …) and versions (if applicable)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (6 by maintainers)
It seems to have been fixed at least v1.27 .
Create
Deploymentusing this manifest and check.spec.strategyfield.nginx-deployment.yamlNext, remove
.spec.strategyfield and apply it again..spec.strategyfield has been changed.nginx-deployment.yamlthanks for your answer,I will try it later.