删除Terminating状态资源

以名称空间monitoring为例

启动一个代理,默认监听在8001

kubectl proxy 

 

生成资源清单文件tmp.josn

kubectl get ns monitoring -o json > tmp.json

 

删除spec字段

{
    "apiVersion": "v1",
    "kind": "Namespace",
    "metadata": {
        "annotations": {
            "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"kind\":\"Namespace\",\"metadata\":{\"annotations\":{},\"name\":\"monitoring\"}}\n"
        },
        "creationTimestamp": "2021-04-30T08:13:01Z",
        "deletionTimestamp": "2021-04-30T08:22:56Z",
        "name": "monitoring",
        "resourceVersion": "35696",
        "selfLink": "/api/v1/namespaces/monitoring",
        "uid": "e15a37d4-a98b-11eb-900f-fa163e5df06c"
    },
    "status": {
        "phase": "Terminating"
    }
}

 

向APIserver发送删除请求

curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json  127.0.0.1:8001/api/v1/namespaces/monitoring/finalize

 

删除Terminating状态资源

上一篇:解决浏览器窗口大小改变时,页面错位的问题


下一篇:Async Function 背后的秘密