1
2
3
4
5
6
7
8
9
10
11
|
#开启一个代理终端
kubectl proxy
Starting to serve on 127.0.0.1:8001
再开启一个操作终端 将test namespace的配置文件输出保存
$ kubectl get ns test -o json > test.json
#在test.json中删除spec及status部分的内容还有metadata字段后的","号,切记!
剩下内容大致如下
{ "apiVersion": "v1",
"kind": "Namespace", "metadata": { "annotations": { "cattle.io/status": "{\"Conditions\":[{\"Type\":\"ResourceQuotaInit\",\"Status\":\"True\",\"Message\":\"\",\"LastUpdateTime\":\"2020-10-09T07:12:17Z\"},{\"Type\":\"InitialRolesPopulated\",\"Status\":\"True\",\"Message\":\"\",\"LastUpdateTime\":\"2020-10-09T07:12:18Z\"}]}", "lifecycle.cattle.io/create.namespace-auth": "true" }, "creationTimestamp": "2020-10-09T07:12:16Z", "deletionTimestamp": "2020-10-09T07:12:22Z", "name": "test", "resourceVersion": "471648079", "selfLink": "/api/v1/namespaces/test", "uid": "862d311e-d87a-48c2-bc48-332a4db9dbdb" } }
调接口删除
$ curl -k -H "Content-Type: application/json" -X PUT --data-binary @test.json http://127.0.0.1:8001/api/v1/namespaces/test/finalize
|