首页 > 其他 > 详细

StatefulSet删除

时间:2021-02-12 08:17:50      阅读:44      评论:0      收藏:0      [点我收藏+]

1.分类

级联删除: 删除StatefulSet时同时删除pod
非级联删除: 删除StatefulSet时不删除pod

2.级联删除

[root@k8s-master01 ~]# kubectl get pod
NAME                     READY   STATUS    RESTARTS   AGE
nginx-6cdd5dd489-p426b   1/1     Running   0          4h4m
web-0                    1/1     Running   0          6h11m
web-1                    1/1     Running   0          6h12m
web-2                    1/1     Running   0          4h23m
web-3                    1/1     Running   0          4h24m
web-4                    1/1     Running   0          4h24m

[root@k8s-master01 ~]# kubectl delete sts  web
statefulset.apps "web" deleted
[root@k8s-master01 ~]# kubectl get pod
NAME                     READY   STATUS        RESTARTS   AGE
nginx-6cdd5dd489-p426b   1/1     Running       0          4h5m
web-0                    1/1     Terminating   0          6h11m
web-1                    0/1     Terminating   0          6h12m
web-2                    0/1     Terminating   0          4h23m
web-3                    1/1     Terminating   0          4h24m
web-4                    1/1     Terminating   0          4h25m

3.非级联删除

[root@k8s-master01 ~]# kubectl get pod
NAME                     READY   STATUS    RESTARTS   AGE
nginx-6cdd5dd489-p426b   1/1     Running   0          4h7m
web-0                    1/1     Running   0          62s
web-1                    1/1     Running   0          42s

[root@k8s-master01 ~]# kubectl delete sts web --cascade=false
statefulset.apps "web" deleted
[root@k8s-master01 ~]# kubectl get sts
No resources found in default namespace.
[root@k8s-master01 ~]# kubectl get pod                            ### 此时的pod变成了孤儿进程,被删除后不会再次重新生产
NAME                     READY   STATUS    RESTARTS   AGE
nginx-6cdd5dd489-p426b   1/1     Running   0          4h10m
web-0                    1/1     Running   0          4m18s
web-1                    1/1     Running   0          3m58s
[root@k8s-master01 ~]# kubectl delete pod web-0 web-1
pod "web-0" deleted
pod "web-1" deleted
[root@k8s-master01 ~]# kubectl get pod
NAME                     READY   STATUS    RESTARTS   AGE
nginx-6cdd5dd489-p426b   1/1     Running   0          4h13m
[root@k8s-master01 ~]# kubectl get pod -l app=nginx -w
NAME                     READY   STATUS    RESTARTS   AGE
nginx-6cdd5dd489-p426b   1/1     Running   0          4h13m
web-0                    1/1     Running   0          7m1s
web-1                    1/1     Running   0          6m41s
web-0                    1/1     Terminating   0          7m3s
web-1                    1/1     Terminating   0          6m43s
web-0                    0/1     Terminating   0          7m4s
web-1                    0/1     Terminating   0          6m44s
web-1                    0/1     Terminating   0          6m50s
web-1                    0/1     Terminating   0          6m50s
web-0                    0/1     Terminating   0          7m10s
web-0                    0/1     Terminating   0          7m10s


StatefulSet删除

原文:https://www.cnblogs.com/Applogize/p/14398217.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!