Forum Navigation
You need to log in to create posts and topics.

namespace stuck in terminating stage

Problem

User wants to delete namespace and remove all resources. after the command kubectl delete <NAMESPACE>. namespace is not removed when examine kubectl get namespace

Solution 

run the following command to export namespace settings

kubectl get namespace <NAMESPACE> -o json > namespacee.json

edit the file and search for this lines

“spec”: {
“finalizers”: [
“kubernetes”
] },

remove the word kubernetes from the text sample:

“spec”: {
“finalizers”: [
]
},

save the file and run the following command

kubectl replace –raw “/api/v1/namespaces/<NAMESPACE>/finalize” -f ./namespace.json

check that the name space has been removed

kubectl get namespace