Terminating
Note that using kubectl edit namespace $NAMESPACE WILL NOT WORK. It has to go through kubectl replace ...
kubectl edit namespace $NAMESPACE
kubectl replace ...
Identify the namespace that is stuck using kubectl get namespaces (this shall be $NAMESPACE)
kubectl get namespaces
$NAMESPACE
Run the following to get the Namespace resource as JSON: kubectl get namespace $NAMESPACE -o json > $NAMESPACE.json
kubectl get namespace $NAMESPACE -o json > $NAMESPACE.json
Modify $NAMESPACE.json and set the property at .spec.finalizers to []
$NAMESPACE.json
.spec.finalizers
[]
Run the following to apply the Namespace resource: kubectl replace --raw "/api/v1/namespaces/$NAMESPACE/finalize -f ./$NAMESPACE.json
kubectl replace --raw "/api/v1/namespaces/$NAMESPACE/finalize -f ./$NAMESPACE.json
Your Namespace resource should be deleted, check with kubectl get namespaces
Last updated 4 years ago