1.檢視當前的pod
[root@master soft]# kubectl get pods
NAME READY STATUS RESTARTS AGE
my-release-minio-0 0/1 Pending 0 16h
my-release-minio-1 0/1 Pending 0 16h
my-release-minio-2 0/1 Pending 0 16h
my-release-minio-3 0/1 Pending 0 16h
my-release-pulsar-bookie-0 0/1 Pending 0 16h
my-release-pulsar-bookie-1 0/1 Pending 0 16h
my-release-pulsar-bookie-2 0/1 Pending 0 16h
my-release-pulsar-bookie-init-7xxnk 0/1 Init:Unknown 0 16h
my-release-pulsar-bookie-init-c2pgm 0/1 Init:Unknown 0 15h
my-release-pulsar-bookie-init-mdgqh 0/1 Init:ImagePullBackOff 0 21m
my-release-pulsar-broker-0 0/1 Pending 0 16h
my-release-pulsar-proxy-0 0/1 Pending 0 16h
my-release-pulsar-pulsar-init-m2mm6 0/1 Init:0/2 2 16h
my-release-pulsar-recovery-0 0/1 Pending 0 16h
my-release-pulsar-zookeeper-0 0/1 Pending 0 16h
2.嘗試刪除某個pod
[root@master soft]# kubectl delete pods my-release-minio-0 --grace-period=0 --force
Warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
pod "my-release-minio-0" force deleted
再次檢視是沒有刪除的
[root@master soft]# kubectl get pods
NAME READY STATUS RESTARTS AGE
my-release-minio-0 0/1 Pending 0 24s
my-release-minio-1 0/1 Pending 0 16h
my-release-minio-2 0/1 Pending 0 16h
my-release-minio-3 0/1 Pending 0 16h
my-release-pulsar-bookie-0 0/1 Pending 0 16h
my-release-pulsar-bookie-1 0/1 Pending 0 16h
my-release-pulsar-bookie-2 0/1 Pending 0 16h
my-release-pulsar-bookie-init-7xxnk 0/1 Init:Unknown 0 16h
my-release-pulsar-bookie-init-c2pgm 0/1 Init:Unknown 0 15h
my-release-pulsar-bookie-init-mdgqh 0/1 Init:ImagePullBackOff 0 23m
my-release-pulsar-broker-0 0/1 Pending 0 16h
my-release-pulsar-proxy-0 0/1 Pending 0 16h
my-release-pulsar-pulsar-init-m2mm6 0/1 Init:0/2 2 16h
my-release-pulsar-recovery-0 0/1 Pending 0 16h
my-release-pulsar-zookeeper-0 0/1 Pending 0 16h
3.檢視describe
kubectl describe pod my-release-minio-0
找到如下專案:
Controlled By: StatefulSet/my-release-minio
若是job型別的,則用如下方式刪除
Controlled By: Job/my-release-pulsar-bookie-init [root@master soft]# kubectl get Job NAME COMPLETIONS DURATION AGE my-release-pulsar-bookie-init 0/1 16h 16h my-release-pulsar-pulsar-init 0/1 16h 16h kubectl delete job my-release-pulsar-pulsar-init --force --grace-period=0
4.檢視StatefulSet
[root@master soft]# kubectl get StatefulSet
NAME READY AGE
my-release-minio 0/4 16h
my-release-pulsar-bookie 0/3 16h
my-release-pulsar-broker 0/1 16h
my-release-pulsar-proxy 0/1 16h
my-release-pulsar-recovery 0/1 16h
my-release-pulsar-zookeeper 0/3 16h
5.刪除StatefulSet
[root@master soft]# kubectl delete StatefulSet my-release-minio --force --grace-period=0
Warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
statefulset.apps "my-release-minio" force deleted
6.再次檢視
[root@master soft]# kubectl get pods
NAME READY STATUS RESTARTS AGE
my-release-pulsar-bookie-0 0/1 Pending 0 16h
my-release-pulsar-bookie-1 0/1 Pending 0 16h
my-release-pulsar-bookie-2 0/1 Pending 0 16h
my-release-pulsar-bookie-init-7xxnk 0/1 Init:Unknown 0 16h
my-release-pulsar-bookie-init-c2pgm 0/1 Init:Unknown 0 15h
my-release-pulsar-bookie-init-mdgqh 0/1 Init:ErrImagePull 0 26m
my-release-pulsar-broker-0 0/1 Pending 0 16h
my-release-pulsar-proxy-0 0/1 Pending 0 16h
my-release-pulsar-pulsar-init-m2mm6 0/1 Init:0/2 2 16h
my-release-pulsar-recovery-0 0/1 Pending 0 16h
my-release-pulsar-zookeeper-0 0/1 Pending 0 16h
說明已經刪除了.