查看命名空间列表:

命名空间 keda 一直处于Terminating 状态

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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格式配置文件导出:

1
kubectl get ns keda -o json > keda.json

编辑json配置文件的"spec"配置,将"finalizers"清空:

1
2
3
4
"spec": {
"finalizers": [
]
},

根据修改后的json配置replace掉原来的ns配置:

1
kubectl replace --raw "/api/v1/namespaces/keda/finalize" -f ./keda.json

再度查看:

已成功删除

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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