11. Delete namespace terminated

How to delete a namespace in "Terminated" state

kubectl get namespace <terminating-namespace> -o json > /tpm/tempfile.json

Edit the JSON file and remove the finalizers from the array.

before

   "spec": {
        "finalizers": [
            "kubernetes"
        ]

after

  "spec": {
        "finalizers": [
        ]
    },
kubectl replace --raw "/api/v1/namespaces/<terminating-namespace>/finalize" -f /tmp/tempfile.json

Last updated

Was this helpful?