Skip to content

Instantly share code, notes, and snippets.

@rahulkj
Last active January 15, 2025 15:59
Show Gist options
  • Save rahulkj/2d3286c5282fc4f2ebce8ca42b4bb0ea to your computer and use it in GitHub Desktop.
Save rahulkj/2d3286c5282fc4f2ebce8ca42b4bb0ea to your computer and use it in GitHub Desktop.
Force delete namespace that is in termination state
NAMESPACE=(servicebinding-system korifi-gateway korifi kpack cert-manager cf)
killall kubectl
for n in ${NAMESPACE[@]}; do
kubectl proxy & kubectl get namespace $n -o json |jq '.spec = {"finalizers":[]}' >temp.json
curl -k -H "Content-Type: application/json" -X PUT --data-binary @temp.json 127.0.0.1:8001/api/v1/namespaces/$n/finalize
rm -rf temp.json
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment