• 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
    
  • 相关阅读:
    查看网页源代码的方法
    Chrome浏览器清除缓存
    copy与内存管理
    分类(Category)
    @class的使用
    @property参数的
    力扣131题、93题(分割回文串,复原IP地址)
    力扣17题(电话号码的字母组合)
    力扣216(组合总和)
    力扣242题、383题(有效的字母异位词,赎金信)
  • 原文地址:https://www.cnblogs.com/Applogize/p/14383523.html
Copyright © 2020-2023  润新知