cce
更新指定的Pod
更新时间:2020/12/16 GMT+08:00
功能介绍
该API用于更新指定Namespace下一个Pod对象。
其中以下字段支持更新:
- metadata.selfLink
- metadata.resourceVersion
- metadata.generation
- metadata.creationTimestamp
- metadata.deletionTimestamp
- metadata.clusterName
- metadata.generateName
- metadata.labels
- metadata.annotations
- spec.initContainers[*].image
- spec.containers[*].image
- spec.activeDeadlineSeconds
- spec.tolerations
其余部分不支持更新。
请求消息
请求参数:
“Content-Type”的详细描述请参见 PATCH请求方法操作说明。
请求示例:
Content-Type: application/json-patch+json
[ { "op": "add", "path": "/spec/containers/0/image", "value": "busybox:latest" } ]
响应消息
响应参数:
响应参数的详细描述请参见表3。
响应示例:
{ "kind": "Pod", "apiVersion": "v1", "metadata": { "name": "hello-world", "namespace": "default", "selfLink": "/api/v1/namespaces/default/pods/hello-world", "uid": "b4b50f8d-5d0e-11e6-aeb9-286ed488fafe", "resourceVersion": "1638", "creationTimestamp": "2016-08-08T02:20:42Z", "labels": { "name": "brace" } }, "spec": { "volumes": [ { "name": "test", "emptyDir": {} }, { "name": "default-token-test2", "secret": { "secretName": "default-token-test2" } } ], "containers": [ { "name": "hello-world", "image": "busybox:latest", "env": [ { "name": "cy", "value": "cy" } ], "resources": {}, "volumeMounts": [ { "name": "test", "mountPath": "/tmp/foo" }, { "name": "default-token-test2", "readOnly": true, "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount" } ], "terminationMessagePath": "/dev/termination-log", "imagePullPolicy": "IfNotPresent" } ], "restartPolicy": "Always", "terminationGracePeriodSeconds": 30, "dnsPolicy": "ClusterFirst", "serviceAccountName": "default", "serviceAccount": "default", "nodeName": "127.0.0.1", "securityContext": {} }, "status": { "phase": "Running", "conditions": [ { "type": "Ready", "status": "False", "lastProbeTime": null, "lastTransitionTime": "2016-08-08T02:20:44Z", "reason": "ContainersNotReady", "message": "containers with unready status: [hello-world]" } ], "hostIP": "127.0.0.1", "podIP": "172.16.0.4", "startTime": "2016-08-08T02:20:42Z", "containerStatuses": [ { "name": "hello-world", "state": { "waiting": { "reason": "CrashLoopBackOff", "message": "Back-off 5m0s restarting failed container=hello-world pod=hello-world_default(b4b50f8d-5d0e-11e6-aeb9-286ed488fafe)" } }, "lastState": { "terminated": { "exitCode": 0, "reason": "Completed", "startedAt": "2016-08-08T03:38:17Z", "finishedAt": "2016-08-08T03:38:17Z", "containerID": "docker://601ce41bd6cafd403ed30d0beb3d27573c74d0207818b973f42268b37051627c" } }, "ready": false, "restartCount": 24, "image": "busybox:latest", "imageID": "docker://sha256:2b8fd9751c4c0f5dd266fcae00707e67a2545ef34f9a29354585f93dac906749", "containerID": "docker://601ce41bd6cafd403ed30d0beb3d27573c74d0207818b973f42268b37051627c" } ] } }
父主题: Pod
