kubectl get pod run-sh-1816639685-xejyk
NAME READY STATUS RESTARTS AGE
run-sh-1816639685-xejyk 2/2 Running 0 26m
Run Code Online (Sandbox Code Playgroud)
"READY = 2/2"是什么意思?与"1/1"相同?
我想通过kubernetes API从我的kubernetes版本:1.24从节点或吊舱中删除标签
kubectl get pod --show-labels | grep all-flow-0fbah
all-flow-0fbah 1/1 Running 2 9d app=all-flow,op=vps1,version=1001
Run Code Online (Sandbox Code Playgroud)
我使用如下命令:
curl --request PATCH --header "Content-Type:application/json-patch+json" http://10.93.78.11:8080/api/v1/namespaces/default/pods/all-flow-0fbah --data '{"metadata":{"labels":{"a":"b"}}}'
Run Code Online (Sandbox Code Playgroud)
但这是行不通的。返回消息如下:
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": "the server responded with the status code 415 but did not return more information",
"details": {},
"code": 415
}
Run Code Online (Sandbox Code Playgroud)
然后我像这样更改curl标头:
curl --request PATCH --header "Content-Type:application/merge-patch+json" http://10.93.78.11:8080/api/v1/namespaces/default/pods/all-flow-0fbah --data '{"meadata":{"labels":{"op":"vps3"}}}'
Run Code Online (Sandbox Code Playgroud)
它不会删除标签,但会向该窗格添加新标签。那么有没有人可以告诉我如何删除pod的标签,例如use命令:
kubectl label pod all-flow-0fbah key-
Run Code Online (Sandbox Code Playgroud)
谢谢!
Run Code Online (Sandbox Code Playgroud)docker version: 1.11.2 curl version: 7.50.3 (x86_64-pc-linux-gnu) libcurl/7.50.3 OpenSSL/1.0.1e zlib/1.2.7
/usr/local/sbin/bin/curl --unix-socket /var/run/docker.sock http://images/json -v
* Trying /var/run/docker.sock...
* Connected to images (/var/run/docker.sock) port 80 (#0)
> GET /json HTTP/1.1
> Host: images
> User-Agent: curl/7.50.3
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Content-Type: text/plain; charset=utf-8
< X-Content-Type-Options: nosniff
< Date: Thu, 22 Sep 2016 06:11:52 GMT
< Content-Length: 19
<
404 page not found
* Curl_http_done: called premature == 0
* Connection #0 to host images …Run Code Online (Sandbox Code Playgroud)