Loading

Namespoace Terminating 解决办法

场景:当我们删除某个k8s 命名空间时候,有时候会半天删不掉,一直提示Terminating,下面介绍解决办法:

[root@rocky01 kubeasz] # kubectl delete ns prom
[root@rocky01 ~] # kubectl get ns | grep prom
prom              Terminating   6m7s
# ###
[root@rocky01 ~] # NS=prom   # 注意改为要删除的NS
[root@rocky01 ~] # kubectl get namespace $NS -o json | jq '.spec.finalizers = []' | kubectl replace --raw "/api/v1/namespaces/$NS/finalize" -f -
[root@rocky01 ~] # kubectl get ns
NAME              STATUS   AGE
argo-rollouts     Active   2d12h
argocd            Active   13h
default           Active   3d12h
ingress-nginx     Active   3d9h
kube-node-lease   Active   3d12h
kube-public       Active   3d12h
kube-system       Active   3d12h
lab               Active   2d18h
media             Active   36h
posted @ 2024-08-09 15:34  Jas0n0ss  阅读(8)  评论(0编辑  收藏  举报