Force Delete StatefulSet and Pods
Issue description
I encountered the problem that when delete statefulset the execution hangs, for example:
kubectl delete statefulset is-en-conductor
it cannot delete the statefulset and associated pods at all
[root@opsft-lb-1 OpenShift] oc get all
NAME                             DESIRED   CURRENT   AGE
statefulsets/is-en-conductor     0         1         5h
statefulsets/is-engine-compute   0         2         5h
NAME                     READY     STATUS        RESTARTS   AGE
po/is-en-conductor-0     0/1       Terminating   2          1h
po/is-engine-compute-0   1/1       Running       0          5h
po/is-engine-compute-1   0/1       Terminating   0          5h
Solution
kubectl delete statefulsets <statefulset name> --force --grace-period=0 --cascade=false
now we only have hanging pods, force delete them
NAME                     READY     STATUS        RESTARTS   AGE
po/is-en-conductor-0     0/1       Terminating   2          1h
po/is-engine-compute-0   1/1       Running       0          5h
po/is-engine-compute-1   0/1       Terminating   0          5h
kubectl delete pod <pod name> --force --grace-period=0
                    
                
                
            
        
浙公网安备 33010602011771号