参数解释

使用Kubectl rollout –help查看滚动更新

[root@node-z9cb ~]# kubectl rollout --help
Manage the rollout of a resource.
 Valid resource types include:
  *  deployments
  *  daemonsets
  *  statefulsets
Examples:
  # Rollback to the previous deployment
  kubectl rollout undo deployment/abc
  # Check the rollout status of a daemonset
  kubectl rollout status daemonset/foo
Available Commands:
  history     View rollout history
  pause       Mark the provided resource as paused
  restart     Restart a resource
  resume      Resume a paused resource
  status      Show the status of the rollout
  undo        Undo a previous rollout
Usage:
  kubectl rollout SUBCOMMAND [options]
Use "kubectl <command> --help" for more information about a given command.
Use "kubectl options" for a list of global command-line options (applies to all commands).

适用服务类型

deployment、daemonset、statNginxefulsetnginx怎么读

命令参数

参数 解释
history 查看服务滚动更新的历史版本
pause 将指定资源设置为暂停使用
restart 滚动重启资源中所有pod
resume 恢复已暂停的资源
status 查看滚动更新完成运行的状态
undo 回滚到之前列表的版本

例子

[root@k8s-10.165.24.168 ~]#  kubectl rollout history deploy  -n kedacom-project-namespace   nginx
deployment.extensions/nginx 
REVISION  CHANGE-CAUSE
1         <none>
[root@k8s-10.165.24.168 ~]# kubectl rollout pause deploy -n test   nginx
deployment.extensions/nginx paused
[root@node-z9cb ~]# kubectl rollout restart deploy -n test   nginx
deployment.apps/nginx restarted
[root@k8s-10.165.24.168 ~]# kubectl rollout resume deploy -n test   nginx
deployment.extensions/nginx resumed
[root@k8s-10.165.24.168 ~]# kubectl rollout status deploy -n test   nginx
deployment "nginx" successfully rolled out
[root@node-z9cb ~]# kubectl rollout undo deploy -n test   nginx --to-revision=1
deployment.apps/nginx rolled back