Tool for force deletion of Kubernetes namespaces
If your Kubernetes cluster namespace stuck in the "Terminating" state you can use this tool for its fast forced deletion
$ k create ns test
namespace/test created
$ kubectl delete ns test
namespace "test" deleted
$ kubectl get ns
NAME STATUS AGE
default Active 66d
kube-node-lease Active 66d
kube-public Active 66d
kube-system Active 66d
kubectl-debug-agent Active 23h
test Terminating 43s
-
Install jq (https://stedolan.github.io/jq/download/)
-
Download k8sdelns sources
curl -Lo k8sdelns-v1.1.tar.gz https://github.com/jenoOvchi/k8sdelns/archive/v1.1.tar.gz
- Extract k8sdelns sources
tar -zxvf k8sdelns-v1.1.tar.gz
- Add execution permission to k8sdelns script
cd k8sdelns-1.1/
chmod +x k8sdelns
- Move k8sdelns script to /usr/local/bin/
sudo mv k8sdelns /usr/local/bin/
- Delete k8sdelns sources
cd ..
rm -rf k8sdelns-v1.1/
rm v1.0.tar.gz
Execute k8sdelns script with your namespace name (for example "test"):
k8sdelns test