How to force delete a Kubernetes Namespace?

前端 未结 2 598
难免孤独
难免孤独 2021-02-01 19:03

How do I force delete Namespaces stuck in Terminating?

Steps to recreate:

  1. Apply this YAML
apiVersion: v1
kind: Namespace
metadata:         


        
2条回答
  •  轮回少年
    2021-02-01 19:52

    I loved this answer extracted from here

    In one terminal:

    kubectl proxy
    

    In another terminal:

    kubectl get ns delete-me -o json | \
      jq '.spec.finalizers=[]' | \
      curl -X PUT http://localhost:8001/api/v1/namespaces/delete-me/finalize -H "Content-Type: application/json" --data @-
    

提交回复
热议问题