- Defining Namespace Variable (namespace name)
NS="my-namespace"
- Retrieve the namespace api state specification
kubectl get namespace $NS -o json > ns.json
- Go back to the previous terminal >> Edit ns.json >> Remove the content inside of spec.finalizers:
"spec": {
"finalizers": [
"kubernetes" <- ("""Remove this value and save the file""")
]
}
- Open a new tab on terminal, and run Kube Proxy
kube proxy
- Return to the previous tab, so execute:
curl -k -H "Content-Type: application/json" -X PUT --data-binary @ns.json "http://127.0.0.1:8001/api/v1/namespaces/${NS}/finalize"
- Check if your namespace was removed:
kubectl get namespaces