Openshift oc Project deletion struck in Terminating
You can try to delete the namespace with a curl command to Openshift API:
1. Get namespace status into json file:
oc get namespace $NS_TO_DELETE -o json > tmp_ns.json
2. Remove the line with "kubernetes" (under "finalizers"):
vi tmp_ns.json
3. Open proxy connection to your cluster (as a background process)
oc proxy &
4. Push the json content to your cluster with curl:
curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp_ns.json http://127.0.0.1:8001/api/v1/namespaces/$NS_TO_DELETE/finalize
5. your-namespace should be gone now:
oc get namespace $NS_TO_DELETE # namespaces not found
6. Switch to the background process (fg
) of the Proxy and stop it (Ctrl+c), or directly with:
kill -9 %%
Note: If you have jq installed, you can run steps 1 & 2 by: oc get namespace $NS_TO_DELETE -o json | jq '.spec = {"finalizers":[]}' > tmp_ns.json