欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Kubernetes删除一直Terminating状态的namespace

程序员文章站 2024-03-11 10:06:13
...

方法一

方法一:
# kubectl delete ns xxx --grace-period=0 --force

方法二

方法二:
#  kubectl edit ns xxx
{
    "kind": "Namespace",
    "apiVersion": "v1",
    "metadata": {
        "name": "xxx",
        "selfLink": "/api/v1/namespaces/openshift",
        "uid": "0a659292-94af-11e5-855c-42010af00002",
        "resourceVersion": "14645862",
        "creationTimestamp": "2015-11-27T02:32:01Z",
        "deletionTimestamp": "2015-12-25T03:20:25Z",
        "annotations": {
            "openshift.io/sa.scc.mcs": "s0:c6,c0",
            "openshift.io/sa.scc.supplemental-groups": "1000030000/10000",
            "openshift.io/sa.scc.uid-range": "1000030000/10000"
        }
    },
    "spec": {
        "finalizers": [
            "openshift.io/origin"
        ]
    },
    "status": {
        "phase": "Terminating"
    }
}
将finalizers数组配置为空数组,退出edit即可
参考链接:
  https://github.com/kubernetes/kubernetes/issues/19317

方法三

查看此空间是否还有没有删除的资源,删除之后再删此空间