飞天使-k8s知识点19-kubernetes实操4-资源调度 标签和选择器:Label与Selector的使用-版本回退

文章目录

      • 添加label
        • 资源调度 Deployment:创建与配置文件解析
        • rs pod deploy 的关联信息展示
        • Deployment:滚动更新
        • Deployment:回滚
          • 回退版本实际操作

添加label

[root@kubeadm-master1 test]# kubectl get pod
NAME                                 READY   STATUS      RESTARTS   AGE
client                               1/1     Running     0          49d
my-pod                               1/1     Running     0          9d
my-pod1                              0/1     Completed   6          83m
net-test1                            1/1     Running     136        56d
net-test2                            1/1     Running     14         56d
nginx-deployment-67dfd6c8f9-5s6nz    1/1     Running     1          56d
tomcat-deployment-6c44f58b47-4pz6d   1/1     Running     1          56d
[root@kubeadm-master1 test]# kubectl get po --show-labels
NAME                                 READY   STATUS      RESTARTS   AGE   LABELS
client                               1/1     Running     0          49d   run=client
my-pod                               1/1     Running     0          9d    test=1.0.0,type=app
my-pod1                              0/1     Completed   6          83m   test=1.0.0,type=app
net-test1                            1/1     Running     136        56d   run=net-test1
net-test2                            1/1     Running     14         56d   run=net-test2
nginx-deployment-67dfd6c8f9-5s6nz    1/1     Running     1          56d   app=nginx,pod-template-hash=67dfd6c8f9
tomcat-deployment-6c44f58b47-4pz6d   1/1     Running     1          56d   app=tomcat,pod-template-hash=6c44f58b47
[root@kubeadm-master1 test]# kubectl label po my-pod author=xx1
pod/my-pod labeled
[root@kubeadm-master1 test]# kubectl get po --show-labels
NAME                                 READY   STATUS      RESTARTS   AGE   LABELS
client                               1/1     Running     0          49d   run=client
my-pod                               1/1     Running     0          9d    author=xx1,test=1.0.0,type=app
my-pod1                              0/1     Completed   6          83m   test=1.0.0,type=app
net-test1                            1/1     Running     136        56d   run=net-test1
net-test2                            1/1     Running     14         56d   run=net-test2
nginx-deployment-67dfd6c8f9-5s6nz    1/1     Running     1          56d   app=nginx,pod-template-hash=67dfd6c8f9
tomcat-deployment-6c44f58b47-4pz6d   1/1     Running     1          56d   app=tomcat,pod-template-hash=6c44f58b47
[root@kubeadm-master1 test]# kubectl label po my-pod author=xxx1 --overwrite
pod/my-pod labeled
[root@kubeadm-master1 test]# kubectl get po --show-labels
NAME                                 READY   STATUS      RESTARTS   AGE   LABELS
client                               1/1     Running     0          49d   run=client
my-pod                               1/1     Running     0          9d    author=xxx1,test=1.0.0,type=app
my-pod1                              0/1     Completed   6          85m   test=1.0.0,type=app
net-test1                            1/1     Running     136        56d   run=net-test1
net-test2                            1/1     Running     14         56d   run=net-test2
nginx-deployment-67dfd6c8f9-5s6nz    1/1     Running     1          56d   app=nginx,pod-template-hash=67dfd6c8f9
tomcat-deployment-6c44f58b47-4pz6d   1/1     Running     1          56d   app=tomcat,pod-template-hash=6c44f58b47


资源调度 Deployment:创建与配置文件解析

飞天使-k8s知识点19-kubernetes实操4-资源调度 标签和选择器:Label与Selector的使用-版本回退_第1张图片

分别是有状态和无状态应用
创建deployment 
[root@kubeadm-master1 ~]# kubectl create deploy nginx-deploy --image=nginx:1.7.9
查看 replicaset
[root@kubeadm-master1 ~]# kubectl get replicaset
NAME                           DESIRED   CURRENT   READY   AGE
nginx-deploy-845964f5bf        1         1         1       2m34s

查看pod
[root@kubeadm-master1 ~]# kubectl get po
NAME                                 READY   STATUS      RESTARTS   AGE
nginx-deploy-845964f5bf-2pvw4        1/1     Running     0          3m

获取deployment的yaml 文件
[root@kubeadm-master1 ~]# kubectl get deploy nginx-deploy -o yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
  creationTimestamp: "2024-02-16T02:25:18Z"
  generation: 1
  labels:
    app: nginx-deploy
  managedFields:
  - apiVersion: apps/v1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:labels:
          .: {}
          f:app: {}
      f:spec:
        f:progressDeadlineSeconds: {}
        f:replicas: {}
        f:revisionHistoryLimit: {}
        f:selector: {}
        f:strategy:
          f:rollingUpdate:
            .: {}
            f:maxSurge: {}
            f:maxUnavailable: {}
          f:type: {}
        f:template:
          f:metadata:
            f:labels:
              .: {}
              f:app: {}
          f:spec:
            f:containers:
              k:{"name":"nginx"}:
                .: {}
                f:image: {}
                f:imagePullPolicy: {}
                f:name: {}
                f:resources: {}
                f:terminationMessagePath: {}
                f:terminationMessagePolicy: {}
            f:dnsPolicy: {}
            f:restartPolicy: {}
            f:schedulerName: {}
            f:securityContext: {}
            f:terminationGracePeriodSeconds: {}
    manager: kubectl-create
    operation: Update
    time: "2024-02-16T02:25:18Z"
  - apiVersion: apps/v1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .: {}
          f:deployment.kubernetes.io/revision: {}
      f:status:
        f:availableReplicas: {}
        f:conditions:
          .: {}
          k:{"type":"Available"}:
            .: {}
            f:lastTransitionTime: {}
            f:lastUpdateTime: {}
            f:message: {}
            f:reason: {}
            f:status: {}
            f:type: {}
          k:{"type":"Progressing"}:
            .: {}
            f:lastTransitionTime: {}
            f:lastUpdateTime: {}
            f:message: {}
            f:reason: {}
            f:status: {}
            f:type: {}
        f:observedGeneration: {}
        f:readyReplicas: {}
        f:replicas: {}
        f:updatedReplicas: {}
    manager: kube-controller-manager
    operation: Update
    time: "2024-02-16T02:25:20Z"
  name: nginx-deploy
  namespace: default
  resourceVersion: "8890971"
  uid: 7951f67e-ad52-436a-8f25-5d8241fa06c6
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: nginx-deploy
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: nginx-deploy
    spec:
      containers:
      - image: nginx:1.7.9
        imagePullPolicy: IfNotPresent
        name: nginx
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
status:
  availableReplicas: 1
  conditions:
  - lastTransitionTime: "2024-02-16T02:25:20Z"
    lastUpdateTime: "2024-02-16T02:25:20Z"
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  - lastTransitionTime: "2024-02-16T02:25:18Z"
    lastUpdateTime: "2024-02-16T02:25:20Z"
    message: ReplicaSet "nginx-deploy-845964f5bf" has successfully progressed.
    reason: NewReplicaSetAvailable
    status: "True"
    type: Progressing
  observedGeneration: 1
  readyReplicas: 1
  replicas: 1
  updatedReplicas: 1
  

飞天使-k8s知识点19-kubernetes实操4-资源调度 标签和选择器:Label与Selector的使用-版本回退_第2张图片

飞天使-k8s知识点19-kubernetes实操4-资源调度 标签和选择器:Label与Selector的使用-版本回退_第3张图片

rs pod deploy 的关联信息展示
[root@kubeadm-master1 ~]# kubectl get po,rs,deploy --show-labels
NAME                                     READY   STATUS      RESTARTS   AGE   LABELS
pod/client                               1/1     Running     0          50d   run=client
pod/my-pod                               1/1     Running     0          9d    author=xxx1,test=1.0.0,type=app
pod/my-pod1                              0/1     Completed   6          19h   test=1.0.0,type=app
pod/net-test1                            1/1     Running     138        57d   run=net-test1
pod/net-test2                            1/1     Running     14         57d   run=net-test2
pod/nginx-deploy-845964f5bf-2pvw4        1/1     Running     0          10m   app=nginx-deploy,pod-template-hash=845964f5bf
pod/nginx-deployment-67dfd6c8f9-5s6nz    1/1     Running     1          56d   app=nginx,pod-template-hash=67dfd6c8f9
pod/tomcat-deployment-6c44f58b47-4pz6d   1/1     Running     1          56d   app=tomcat,pod-template-hash=6c44f58b47

NAME                                           DESIRED   CURRENT   READY   AGE   LABELS
replicaset.apps/nginx-deploy-845964f5bf        1         1         1       10m   app=nginx-deploy,pod-template-hash=845964f5bf
replicaset.apps/nginx-deployment-67dfd6c8f9    1         1         1       56d   app=nginx,pod-template-hash=67dfd6c8f9
replicaset.apps/tomcat-deployment-6c44f58b47   1         1         1       56d   app=tomcat,pod-template-hash=6c44f58b47

NAME                                READY   UP-TO-DATE   AVAILABLE   AGE   LABELS
deployment.apps/nginx-deploy        1/1     1            1           10m   app=nginx-deploy
deployment.apps/nginx-deployment    1/1     1            1           56d   app=nginx
deployment.apps/tomcat-deployment   1/1     1            1           56d   app=tomcat
Deployment:滚动更新
修改镜像版本
kubectl edit deploy
image 选择升级为高版本

改完之后运行这个命令看 deploy pod 的变化
[root@kubeadm-master1 ~]# kubectl get deploy
NAME                READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deploy        3/3     1            3           20m
nginx-deployment    1/1     1            1           56d
tomcat-deployment   1/1     1            1           56d
[root@kubeadm-master1 ~]# kubectl get deploy
NAME                READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deploy        3/3     1            3           20m
nginx-deployment    1/1     1            1           56d
tomcat-deployment   1/1     1            1           56d
[root@kubeadm-master1 ~]# kubectl get deploy
NAME                READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deploy        3/3     2            3           20m
nginx-deployment    1/1     1            1           56d
tomcat-deployment   1/1     1            1           56d
[root@kubeadm-master1 ~]# kubectl get deploy
NAME                READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deploy        3/3     2            3           20m
nginx-deployment    1/1     1            1           56d
tomcat-deployment   1/1     1            1           56d
[root@kubeadm-master1 ~]# kubectl get deploy
NAME                READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deploy        3/3     2            3           20m
nginx-deployment    1/1     1            1           56d
tomcat-deployment   1/1     1            1           56d
[root@kubeadm-master1 ~]# kubectl get deploy
NAME                READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deploy        3/3     2            3           20m
nginx-deployment    1/1     1            1           56d
tomcat-deployment   1/1     1            1           56d
[root@kubeadm-master1 ~]# kubectl get deploy
NAME                READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deploy        3/3     2            3           20m
nginx-deployment    1/1     1            1           56d
tomcat-deployment   1/1     1            1           56d
[root@kubeadm-master1 ~]# kubectl get deploy
NAME                READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deploy        3/3     2            3           20m
nginx-deployment    1/1     1            1           56d
tomcat-deployment   1/1     1            1           56d
[root@kubeadm-master1 ~]# kubectl get deploy
NAME                READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deploy        3/3     2            3           20m
nginx-deployment    1/1     1            1           56d
tomcat-deployment   1/1     1            1           56d
[root@kubeadm-master1 ~]# kubectl get deploy  --show-labels
NAME                READY   UP-TO-DATE   AVAILABLE   AGE   LABELS
nginx-deploy        3/3     3            3           20m   app=nginx-deploy
nginx-deployment    1/1     1            1           56d   app=nginx
tomcat-deployment   1/1     1            1           56d   app=tomcat

查看滚动更新的状态
[root@kubeadm-master1 ~]# kubectl rollout status deploy nginx-deploy
deployment "nginx-deploy" successfully rolled out



修改nginx的镜像为1.7.9

[root@kubeadm-master1 ~]# kubectl set image deployment/nginx-deploy nginx=nginx:1.7.9
deployment.apps/nginx-deploy image updated
[root@kubeadm-master1 ~]# kubectl get deploy
NAME                READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deploy        3/3     3            3           24m
nginx-deployment    1/1     1            1           56d
tomcat-deployment   1/1     1            1           56d
[root@kubeadm-master1 ~]# kubectl get deploy
NAME                READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deploy        3/3     3            3           24m
nginx-deployment    1/1     1            1           56d
tomcat-deployment   1/1     1            1           56d
[root@kubeadm-master1 ~]# kubectl rollout status deploy nginx-deploy
deployment "nginx-deploy" successfully rolled out
[root@kubeadm-master1 ~]# kubectl describe deploy nginx-deploy
Name:                   nginx-deploy
Namespace:              default
CreationTimestamp:      Fri, 16 Feb 2024 10:25:18 +0800
Labels:                 app=nginx-deploy
Annotations:            deployment.kubernetes.io/revision: 3
Selector:               app=nginx-deploy
Replicas:               3 desired | 3 updated | 3 total | 3 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  25% max unavailable, 25% max surge
Pod Template:
  Labels:  app=nginx-deploy
  Containers:
   nginx:
    Image:        nginx:1.7.9
    Port:         
    Host Port:    
    Environment:  
    Mounts:       
  Volumes:        
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Available      True    MinimumReplicasAvailable
  Progressing    True    NewReplicaSetAvailable
OldReplicaSets:  
NewReplicaSet:   nginx-deploy-845964f5bf (3/3 replicas created)
Events:
  Type    Reason             Age                From                   Message
  ----    ------             ----               ----                   -------
  Normal  ScalingReplicaSet  8m58s              deployment-controller  Scaled up replica set nginx-deploy-845964f5bf to 3
  Normal  ScalingReplicaSet  5m6s               deployment-controller  Scaled up replica set nginx-deploy-968b78ccf to 1
  Normal  ScalingReplicaSet  4m56s              deployment-controller  Scaled down replica set nginx-deploy-845964f5bf to 2
  Normal  ScalingReplicaSet  4m56s              deployment-controller  Scaled up replica set nginx-deploy-968b78ccf to 2
  Normal  ScalingReplicaSet  4m47s              deployment-controller  Scaled up replica set nginx-deploy-968b78ccf to 3
  Normal  ScalingReplicaSet  4m47s              deployment-controller  Scaled down replica set nginx-deploy-845964f5bf to 1
  Normal  ScalingReplicaSet  4m45s              deployment-controller  Scaled down replica set nginx-deploy-845964f5bf to 0
  Normal  ScalingReplicaSet  39s (x2 over 25m)  deployment-controller  Scaled up replica set nginx-deploy-845964f5bf to 1
  Normal  ScalingReplicaSet  38s                deployment-controller  Scaled down replica set nginx-deploy-968b78ccf to 2
  Normal  ScalingReplicaSet  36s (x4 over 38s)  deployment-controller  (combined from similar events): Scaled down replica set nginx-deploy-968b78ccf to 0

查看rs1 和 rs2 的更新状态,上一个变成0 ,新的变成3 
[root@kubeadm-master1 ~]# kubectl get rs --show-labels
NAME                           DESIRED   CURRENT   READY   AGE     LABELS
nginx-deploy-845964f5bf        3         3         3       27m     app=nginx-deploy,pod-template-hash=845964f5bf
nginx-deploy-968b78ccf         0         0         0       7m58s   app=nginx-deploy,pod-template-hash=968b78ccf

Deployment:回滚
[root@kubeadm-master1 ~]# kubectl set image deployment/nginx-deploy nginx=nginx:1.9.1
deployment.apps/nginx-deploy image updated
[root@kubeadm-master1 ~]# kubectl rollout status deployments nginx-deploy
deployment "nginx-deploy" successfully rolled out
[root@kubeadm-master1 ~]# kubectl get pod
NAME                                 READY   STATUS      RESTARTS   AGE
client                               1/1     Running     0          50d
my-pod                               1/1     Running     0          9d
my-pod1                              0/1     Completed   6          19h
net-test1                            1/1     Running     138        57d
net-test2                            1/1     Running     14         57d
nginx-deploy-968b78ccf-8lb9c         1/1     Running     0          16s
nginx-deploy-968b78ccf-d8mhr         1/1     Running     0          17s
nginx-deploy-968b78ccf-nqq4s         1/1     Running     0          19s
nginx-deployment-67dfd6c8f9-5s6nz    1/1     Running     1          56d
tomcat-deployment-6c44f58b47-4pz6d   1/1     Running     1          56d
[root@kubeadm-master1 ~]# kubectl describe deploy nginx-deploy
Name:                   nginx-deploy
Namespace:              default
CreationTimestamp:      Fri, 16 Feb 2024 10:25:18 +0800
Labels:                 app=nginx-deploy
Annotations:            deployment.kubernetes.io/revision: 4
Selector:               app=nginx-deploy
Replicas:               3 desired | 3 updated | 3 total | 3 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  25% max unavailable, 25% max surge
Pod Template:
  Labels:  app=nginx-deploy
  Containers:
   nginx:
    Image:        nginx:1.9.1
    Port:         
    Host Port:    
    Environment:  
    Mounts:       
  Volumes:        
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Available      True    MinimumReplicasAvailable
  Progressing    True    NewReplicaSetAvailable
OldReplicaSets:  
NewReplicaSet:   nginx-deploy-968b78ccf (3/3 replicas created)
Events:
  Type    Reason             Age                From                   Message
  ----    ------             ----               ----                   -------
  Normal  ScalingReplicaSet  25m                deployment-controller  Scaled up replica set nginx-deploy-845964f5bf to 3
  Normal  ScalingReplicaSet  17m (x2 over 41m)  deployment-controller  Scaled up replica set nginx-deploy-845964f5bf to 1
  Normal  ScalingReplicaSet  17m                deployment-controller  Scaled down replica set nginx-deploy-968b78ccf to 2
  Normal  ScalingReplicaSet  17m (x4 over 17m)  deployment-controller  (combined from similar events): Scaled down replica set nginx-deploy-968b78ccf to 0
  Normal  ScalingReplicaSet  48s (x2 over 21m)  deployment-controller  Scaled up replica set nginx-deploy-968b78ccf to 1
  Normal  ScalingReplicaSet  46s (x2 over 21m)  deployment-controller  Scaled up replica set nginx-deploy-968b78ccf to 2
  Normal  ScalingReplicaSet  46s (x2 over 21m)  deployment-controller  Scaled down replica set nginx-deploy-845964f5bf to 2
  Normal  ScalingReplicaSet  45s (x2 over 21m)  deployment-controller  Scaled down replica set nginx-deploy-845964f5bf to 1
  Normal  ScalingReplicaSet  45s (x2 over 21m)  deployment-controller  Scaled up replica set nginx-deploy-968b78ccf to 3
  Normal  ScalingReplicaSet  44s (x2 over 21m)  deployment-controller  Scaled down replica set nginx-deploy-845964f5bf to 0

查看历史版本
[root@kubeadm-master1 ~]# kubectl rollout history deployment/nginx-deploy
deployment.apps/nginx-deploy
REVISION  CHANGE-CAUSE
3         
4         


如果修改时候 kubectl set image deployment/nginx-deploy nginx=nginx:1.7.9 --record 
上面的none 就会记录详细的信息


查看历史版本详细信息
kubectl rollout history deployment/nginx-deploy --revision=3

确认回退版本之后
kubectl rollout undo deployment/nginx-deploy --to-revision=2

查看回退版本的状态
kubectl get deploy 
kubectl describe deploy 
回退版本实际操作
[root@kubeadm-master1 ~]# kubectl describe deploy nginx-deploy
Name:                   nginx-deploy
Namespace:              default
CreationTimestamp:      Fri, 16 Feb 2024 10:25:18 +0800
Labels:                 app=nginx-deploy
Annotations:            deployment.kubernetes.io/revision: 4
Selector:               app=nginx-deploy
Replicas:               3 desired | 3 updated | 3 total | 3 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  25% max unavailable, 25% max surge
Pod Template:
  Labels:  app=nginx-deploy
  Containers:
   nginx:
    Image:        nginx:1.9.1
    Port:         
    Host Port:    
    Environment:  
    Mounts:       
  Volumes:        
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Available      True    MinimumReplicasAvailable
  Progressing    True    NewReplicaSetAvailable
OldReplicaSets:  
NewReplicaSet:   nginx-deploy-968b78ccf (3/3 replicas created)
Events:
  Type    Reason             Age                From                   Message
  ----    ------             ----               ----                   -------
  Normal  ScalingReplicaSet  37m                deployment-controller  Scaled up replica set nginx-deploy-845964f5bf to 3
  Normal  ScalingReplicaSet  29m (x2 over 53m)  deployment-controller  Scaled up replica set nginx-deploy-845964f5bf to 1
  Normal  ScalingReplicaSet  29m                deployment-controller  Scaled down replica set nginx-deploy-968b78ccf to 2
  Normal  ScalingReplicaSet  29m (x4 over 29m)  deployment-controller  (combined from similar events): Scaled down replica set nginx-deploy-968b78ccf to 0
  Normal  ScalingReplicaSet  12m (x2 over 34m)  deployment-controller  Scaled up replica set nginx-deploy-968b78ccf to 1
  Normal  ScalingReplicaSet  12m (x2 over 33m)  deployment-controller  Scaled up replica set nginx-deploy-968b78ccf to 2
  Normal  ScalingReplicaSet  12m (x2 over 33m)  deployment-controller  Scaled down replica set nginx-deploy-845964f5bf to 2
  Normal  ScalingReplicaSet  12m (x2 over 33m)  deployment-controller  Scaled down replica set nginx-deploy-845964f5bf to 1
  Normal  ScalingReplicaSet  12m (x2 over 33m)  deployment-controller  Scaled up replica set nginx-deploy-968b78ccf to 3
  Normal  ScalingReplicaSet  12m (x2 over 33m)  deployment-controller  Scaled down replica set nginx-deploy-845964f5bf to 0
[root@kubeadm-master1 ~]# kubectl rollout history deployment/nginx-deploy --revision=4
deployment.apps/nginx-deploy with revision #4
Pod Template:
  Labels:	app=nginx-deploy
	pod-template-hash=968b78ccf
  Containers:
   nginx:
    Image:	nginx:1.9.1
    Port:	
    Host Port:	
    Environment:	
    Mounts:	
  Volumes:	

[root@kubeadm-master1 ~]# kubectl rollout history deployment/nginx-deploy --revision=3
deployment.apps/nginx-deploy with revision #3
Pod Template:
  Labels:	app=nginx-deploy
	pod-template-hash=845964f5bf
  Containers:
   nginx:
    Image:	nginx:1.7.9
    Port:	
    Host Port:	
    Environment:	
    Mounts:	
  Volumes:	

[root@kubeadm-master1 ~]# kubectl rollout undo deployment/nginx-deploy --to-revision=3
deployment.apps/nginx-deploy rolled back
[root@kubeadm-master1 ~]# kubectl describe deploy nginx-deploy
Name:                   nginx-deploy
Namespace:              default
CreationTimestamp:      Fri, 16 Feb 2024 10:25:18 +0800
Labels:                 app=nginx-deploy
Annotations:            deployment.kubernetes.io/revision: 5
Selector:               app=nginx-deploy
Replicas:               3 desired | 3 updated | 3 total | 3 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  25% max unavailable, 25% max surge
Pod Template:
  Labels:  app=nginx-deploy
  Containers:
   nginx:
    Image:        nginx:1.7.9
    Port:         
    Host Port:    
    Environment:  
    Mounts:       
  Volumes:        
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Available      True    MinimumReplicasAvailable
  Progressing    True    NewReplicaSetAvailable
OldReplicaSets:  
NewReplicaSet:   nginx-deploy-845964f5bf (3/3 replicas created)
Events:
  Type    Reason             Age                From                   Message
  ----    ------             ----               ----                   -------
  Normal  ScalingReplicaSet  30m (x4 over 30m)  deployment-controller  (combined from similar events): Scaled down replica set nginx-deploy-968b78ccf to 0
  Normal  ScalingReplicaSet  13m (x2 over 34m)  deployment-controller  Scaled up replica set nginx-deploy-968b78ccf to 1
  Normal  ScalingReplicaSet  13m (x2 over 34m)  deployment-controller  Scaled down replica set nginx-deploy-845964f5bf to 2
  Normal  ScalingReplicaSet  13m (x2 over 34m)  deployment-controller  Scaled up replica set nginx-deploy-968b78ccf to 2
  Normal  ScalingReplicaSet  13m (x2 over 34m)  deployment-controller  Scaled up replica set nginx-deploy-968b78ccf to 3
  Normal  ScalingReplicaSet  13m (x2 over 34m)  deployment-controller  Scaled down replica set nginx-deploy-845964f5bf to 1
  Normal  ScalingReplicaSet  13m (x2 over 34m)  deployment-controller  Scaled down replica set nginx-deploy-845964f5bf to 0
  Normal  ScalingReplicaSet  10s (x3 over 54m)  deployment-controller  Scaled up replica set nginx-deploy-845964f5bf to 1
  Normal  ScalingReplicaSet  9s (x2 over 30m)   deployment-controller  Scaled down replica set nginx-deploy-968b78ccf to 2
  Normal  ScalingReplicaSet  9s                 deployment-controller  Scaled up replica set nginx-deploy-845964f5bf to 2
  Normal  ScalingReplicaSet  8s (x2 over 38m)   deployment-controller  Scaled up replica set nginx-deploy-845964f5bf to 3
  Normal  ScalingReplicaSet  8s                 deployment-controller  Scaled down replica set nginx-deploy-968b78ccf to 1
  Normal  ScalingReplicaSet  6s                 deployment-controller  Scaled down replica set nginx-deploy-968b78ccf to 0

你可能感兴趣的:(kubernetes,容器,云原生)