Kubernetes 命名空间管理

Summary: Author: 张亚飞 | Read Time: 1 minute read | Published: 2023-06-11
Filed under Categories: KubernetesTags: Kubernetes, Cilium,

Namespace 命名空间管理

Namespace 命名空间无法删除

有一次删除命名空间卡住了:

$ kubectl delete ns gitlab

查看命名空间,状态一直显示为 Terminating

$ kubectl get ns -w
NAME                              STATUS        AGE
gitlab                            Terminating   11h

查看命名空间所有残留资源

kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get --show-kind --ignore-not-found -n <terminating-namespace>

如果没有发现卸载残留,可以使用以下命令更改 namespace 状态进行删除:

kubectl patch ns gitlab -p '{"metadata":{"finalizers":null}}'

参考

Comments

Cor-Ethan, the beverage → www.iirii.com