zoukankan      html  css  js  c++  java
  • Deployment回滚

    1.查看当前镜像

    [root@k8s-master01 ~]# kubectl get deploy nginx -oyaml|grep image
        kubernetes.io/change-cause: kubectl set image deploy nginx nginx=nginx:1.15.3
                    f:imagePullPolicy: {}
                    f:image: {}
          - image: nginx:1.15.2
            imagePullPolicy: IfNotPresent
    

    2.查看更新历史

    [root@k8s-master01 ~]# kubectl rollout history deploy nginx
    deployment.apps/nginx 
    REVISION  CHANGE-CAUSE
    8         kubectl set image deploy nginx nginx=nginx:1.15.2 --record=true
    9         kubectl set image deploy nginx nginx=nginx:1.15.4 --record=true
    10        kubectl set image deploy nginx nginx=nginx:1.15.3 --record=true
    11        kubectl set image deploy nginx nginx=nginx:1.15.3 --record=true
    15        kubectl set image deploy nginx nginx=1.15.4 --record=true
    16        kubectl set image deploy nginx nginx=nginx:1.15.3 --record=true
    

    3.查看具体某个信息

    [root@k8s-master01 ~]# kubectl rollout  history deploy nginx --revision=16 
    deployment.apps/nginx with revision #16
    Pod Template:
      Labels:	app=nginx
    	pod-template-hash=65965557f7
      Annotations:	kubernetes.io/change-cause: kubectl set image deploy nginx nginx=nginx:1.15.3 --record=true
      Containers:
       nginx:
        Image:	nginx:1.15.2
        Port:	<none>
        Host Port:	<none>
        Limits:
          cpu:	200m
          memory:	128Mi
        Requests:
          cpu:	10m
          memory:	16Mi
        Environment:	<none>
        Mounts:	<none>
      Volumes:	<none>
    

    4.回滚到上个版本

    [root@k8s-master01 ~]# kubectl rollout  undo deploy nginx 
    deployment.apps/nginx rolled back
    

    5.回到指定版本

    [root@k8s-master01 ~]# kubectl rollout undo deploy nginx --to-revision=9
    [root@k8s-master01 ~]# kubectl get pod
    NAME                     READY   STATUS    RESTARTS   AGE
    nginx-6cdd5dd489-bs5wz   1/1     Running   0          59s
    nginx-6cdd5dd489-n8xv9   1/1     Running   0          92s
    [root@k8s-master01 ~]# kubectl get deploy nginx  -oyaml|grep image
        kubernetes.io/change-cause: kubectl set image deploy nginx nginx=nginx:1.15.4
                    f:imagePullPolicy: {}
                    f:image: {}
          - image: nginx:1.15.4
            imagePullPolicy: IfNotPresent
    
  • 相关阅读:
    .net批量插入SqlServer数据库的方法:
    Google主页中国元宵节
    左岸读书你是想读书,还是想读完书?
    Google主页中国著名教育家和画家 丰子恺先生 诞辰114周年
    【转载】图的遍历
    Google主页爱尔兰作家 布拉姆斯托克诞辰165周年
    诺基亚黯然关闭其在欧洲的最后一个手机工厂的背后
    [POJ 1012] Joseph(约瑟夫)
    台湾南投3.27地震
    左岸读书语不惊人死不休(95)
  • 原文地址:https://www.cnblogs.com/Applogize/p/14383523.html
Copyright © 2011-2022 走看看