【真】K8s强制删除命名空间(namespace)

查看命名空间列表:
kubectl get ns

NAME               STATUS        AGE
default            Active        87d
dev                Active        21d
ingress-nginx      Active        126m
keda               Terminating   126m
kube-flannel       Active        87d
kube-node-lease    Active        87d
kube-public        Active        87d
kube-system        Active        87d
openfaas           Active        87d
openfaas-fn        Active        87d
openfunction       Active        28h
tekton-pipelines   Active        126m
将无法删除命名空间的json格式配置文件导出:
kubectl get ns keda -o json > keda.json
编辑json配置文件的"spec"配置,将"finalizers"清空:
    "spec": {
        "finalizers": [
        ]
    },
根据修改后的json配置replace掉原来的ns配置:
kubectl replace --raw "/api/v1/namespaces/keda/finalize" -f ./keda.json
再度查看:
kubectl get ns

NAME               STATUS   AGE
default            Active   87d
dev                Active   21d
ingress-nginx      Active   144m
kube-flannel       Active   87d
kube-node-lease    Active   87d
kube-public        Active   87d
kube-system        Active   87d
openfaas           Active   87d
openfaas-fn        Active   87d
openfunction       Active   28h
tekton-pipelines   Active   144m

你可能感兴趣的:(kubernetes,容器,云原生)