'How to rolling restart pods without changing deployment yaml in kubernetes?
In kubernetes there is a rolling update (automatically without downtime) but there is not a rolling restart, at least i could not find. We have to change deployment yaml. Is there a way to make rolling "restart", preferably without changing deployment yaml?
Solution 1:[1]
Before kubernetes 1.15 the answer is no. But there is a workaround of patching deployment spec with a dummy annotation:
kubectl patch deployment web -p \
"{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"date\":\"`date +'%s'`\"}}}}}"
As of kubernetes 1.15 you can use:
kubectl rollout restart deployment your_deployment_name
- Created a new
kubectl rollout restartcommand that does a rolling restart of a deployment.kubectl rollout restartnow works for DaemonSets and StatefulSets
Solution 2:[2]
If you use k9s, the restart command can be found if you select deployments, statefulsets or daemonsets:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | stratovarius |
| Solution 2 | Brimstedt |

