如何滚动重新启动吊舱不改变部署在库伯内特?

在库伯内特有一个滚动更新(自动没有停机时间) ,但没有一个滚动重新启动,至少我不能找到。我们得改变部署方案。有没有办法使滚动“重新启动”,最好不改变部署 yaml?

85071 次浏览

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

CLI Improvements

  • Created a new kubectl rollout restart command that does a rolling restart of a deployment.
  • kubectl rollout restart now works for DaemonSets and StatefulSets

If you use k9s, the restart command can be found if you select deployments, statefulsets or daemonsets:

screenshot of k9s