其他分享
首页 > 其他分享> > StatefulSet分段更新

StatefulSet分段更新

作者:互联网

1.查看pod

[root@k8s-master01 ~]# kubectl  get pod
NAME                     READY   STATUS    RESTARTS   AGE
web-0                    1/1     Running   0          111m
web-1                    1/1     Running   0          112m
web-2                    1/1     Running   0          3m7s
web-3                    1/1     Running   0          4m14s
web-4                    1/1     Running   0          4m36s

2.编辑文件

[root@k8s-master01 ~]# kubectl edit sts web

  updateStrategy:
    rollingUpdate:
      partition: 2   ## 更新大于或等于2的web
    type: RollingUpdate

3.查看更新

[root@k8s-master01 ~]# kubectl get pod -l app=nginx -w
NAME                     READY   STATUS              RESTARTS   AGE
nginx-6cdd5dd489-bs5wz   1/1     Running             0          4d17h
nginx-6cdd5dd489-n8xv9   1/1     Running             0          4d17h
web-0                    1/1     Running             0          104m
web-1                    1/1     Running             0          105m
web-2                    1/1     Running             0          106m
web-3                    0/1     ContainerCreating   0          21s
web-3                    1/1     Running             0          23s
web-4                    0/1     Pending             0          0s
web-4                    0/1     Pending             0          0s
web-4                    0/1     ContainerCreating   0          1s
web-4                    1/1     Running             0          30s
web-4                    1/1     Terminating         0          55s
web-4                    0/1     Terminating         0          57s
web-4                    0/1     Terminating         0          114s
web-4                    0/1     Terminating         0          114s
web-4                    0/1     Pending             0          0s
web-4                    0/1     Pending             0          0s
web-4                    0/1     ContainerCreating   0          0s
web-4                    1/1     Running             0          20s
web-3                    1/1     Terminating         0          2m37s
web-3                    0/1     Terminating         0          2m38s
web-3                    0/1     Terminating         0          2m39s
web-3                    0/1     Terminating         0          2m39s
web-3                    0/1     Pending             0          0s
web-3                    0/1     Pending             0          0s
web-3                    0/1     ContainerCreating   0          0s
web-3                    1/1     Running             0          18s
web-2                    1/1     Terminating         0          108m
web-2                    0/1     Terminating         0          108m
web-2                    0/1     Terminating         0          109m
web-2                    0/1     Terminating         0          109m
web-2                    0/1     Pending             0          0s
web-2                    0/1     Pending             0          0s
web-2                    0/1     ContainerCreating   0          0s
web-2                    1/1     Running             0          20s

4.查看镜像

[root@k8s-master01 ~]# kubectl get pod web-1 -oyaml|grep image
            f:image: {}
            f:imagePullPolicy: {}
  - image: nginx:1.15.4
    imagePullPolicy: Always
    image: nginx:1.15.4
    imageID: docker-pullable://nginx@sha256:e8ab8d42e0c34c104ac60b43ba60b19af08e19a0e6d50396bdfd4cef0347ba83

[root@k8s-master01 ~]# kubectl get pod web-2 -oyaml|grep image
            f:image: {}
            f:imagePullPolicy: {}
  - image: nginx:1.15.2
    imagePullPolicy: Always
    image: nginx:1.15.2
    imageID: docker-pullable://nginx@sha256:d85914d547a6c92faa39ce7058bd7529baacab7e0cd4255442b04577c4d1f424
``

标签:web,StatefulSet,分段,0s,更新,nginx,Running,Terminating,Pending
来源: https://www.cnblogs.com/Applogize/p/14397947.html