[zh] Sync resize-container-resources.md
This commit is contained in:
parent
f1ddfbff4c
commit
ecf7d7ed1c
|
|
@ -42,43 +42,62 @@ that has a different resource requirement.
|
|||
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)。
|
||||
并让[工作负载控制器](/zh-cn/docs/concepts/workloads/controllers/)创建一个具有不同资源需求的新 Pod。
|
||||
|
||||
<!--
|
||||
A resize request is made through the pod `/resize` subresource, which takes the full updated pod for
|
||||
an update request, or a patch on the pod object for a patch request.
|
||||
-->
|
||||
resize 请求通过 Pod 的 `/resize` 子资源发出,
|
||||
它会通过已完整更新的 Pod 来发出 update 请求,或对此 Pod 对象打补丁发出 patch 请求。
|
||||
|
||||
<!--
|
||||
For in-place resize of pod resources:
|
||||
- Container's resource `requests` and `limits` are _mutable_ for CPU
|
||||
and memory resources.
|
||||
- `allocatedResources` field in `containerStatuses` of the Pod's status reflects
|
||||
the resources allocated to the pod's containers.
|
||||
- `resources` field in `containerStatuses` of the Pod's status reflects the
|
||||
actual resource `requests` and `limits` that are configured on the running
|
||||
containers as reported by the container runtime.
|
||||
- A container's resource `requests` and `limits` are _mutable_ for CPU
|
||||
and memory resources. These fields represent the _desired_ resources for the container.
|
||||
- The `resources` field in `containerStatuses` of the Pod's status reflects the resources
|
||||
_allocated_ to the pod's containers. For running containers, this reflects the actual resource
|
||||
`requests` and `limits` that are configured as reported by the container runtime. For non-running
|
||||
containers, these are the resources allocated for the container when it starts.
|
||||
-->
|
||||
对于原地调整 Pod 资源而言:
|
||||
|
||||
- 针对 CPU 和内存资源的容器的 `requests` 和 `limits` 是**可变更的**。
|
||||
- Pod 状态中 `containerStatuses` 的 `allocatedResources` 字段反映了分配给 Pod 容器的资源。
|
||||
- Pod 状态中 `containerStatuses` 的 `resources`
|
||||
字段反映了如同容器运行时所报告的、针对正运行的容器配置的实际资源 `requests` 和 `limits`。
|
||||
这些字段表示容器所用的**预期**资源。
|
||||
- Pod 状态中 `containerStatuses` 的 `resources` 字段反映了分配给 Pod 容器的资源。
|
||||
对于正运行的容器,这反映了基于容器运行时的报告所配置的实际资源 `requests` 和 `limits`。
|
||||
对于未运行的容器,这些是启动时为容器分配的资源。
|
||||
|
||||
<!--
|
||||
- `resize` field in the Pod's status shows the status of the last requested
|
||||
- The `resize` field in the Pod's status shows the status of the last requested
|
||||
pending resize. It can have the following values:
|
||||
- `Proposed`: This value indicates an acknowledgement of the requested resize
|
||||
and that the request was validated and recorded.
|
||||
- `Proposed`: This value indicates that a pod was resized, but the Kubelet has not yet processed
|
||||
the resize.
|
||||
- `InProgress`: This value indicates that the node has accepted the resize
|
||||
request and is in the process of applying it to the pod's containers.
|
||||
- `Deferred`: This value means that the requested resize cannot be granted at
|
||||
this time, and the node will keep retrying. The resize may be granted when
|
||||
other pods leave and free up node resources.
|
||||
other pods are removed and free up node resources.
|
||||
- `Infeasible`: is a signal that the node cannot accommodate the requested
|
||||
resize. This can happen if the requested resize exceeds the maximum
|
||||
resources the node can ever allocate for a pod.
|
||||
- `""`: An empty or unset value indicates that the last resize completed. This should only be the
|
||||
case if the resources in the container spec match the resources in the container status.
|
||||
-->
|
||||
- Pod 状态中 `resize` 字段显示上次请求待处理的调整状态。此字段可以具有以下值:
|
||||
- `Proposed`:此值表示请求调整已被确认,并且请求已被验证和记录。
|
||||
- `Proposed`:此值表示 Pod 大小已被调整,但 kubelet 还未处理此调整请求。
|
||||
- `InProgress`:此值表示节点已接受调整请求,并正在将其应用于 Pod 的容器。
|
||||
- `Deferred`:此值意味着在此时无法批准请求的调整,节点将继续重试。
|
||||
当其他 Pod 退出并释放节点资源时,调整可能会被真正实施。
|
||||
当其他 Pod 被移除并释放节点资源时,调整可能会被真正实施。
|
||||
- `Infeasible`:此值是一种信号,表示节点无法承接所请求的调整值。
|
||||
如果所请求的调整超过节点可分配给 Pod 的最大资源,则可能会发生这种情况。
|
||||
- `""`:留空或不设置,表示上一次调整已完成。
|
||||
只有容器规约中的资源与容器状态中的资源相匹配时,才会是这种情况。
|
||||
|
||||
<!--
|
||||
If a node has pods with an incomplete resize, the scheduler will compute the pod requests from the
|
||||
maximum of a container's desired resource requests, and it's actual requests reported in the status.
|
||||
-->
|
||||
如果节点有一些 Pod 还未完成调整,调度器将基于容器的预期资源请求的最大值来计算 Pod 请求,
|
||||
它是状态中所报告的实际请求。
|
||||
|
||||
## {{% heading "prerequisites" %}}
|
||||
|
||||
|
|
@ -169,6 +188,35 @@ have changed, the container will be restarted in order to resize its memory.
|
|||
|
||||
<!-- steps -->
|
||||
|
||||
<!--
|
||||
## Limitations
|
||||
|
||||
In-place resize of pod resources currently has the following limitations:
|
||||
-->
|
||||
## 限制 {#limitations}
|
||||
|
||||
<!--
|
||||
- Only CPU and memory resources can be changed.
|
||||
- Pod QoS Class cannot change. This means that requests must continue to equal limits for Guaranteed
|
||||
pods, Burstable pods cannot set requests and limits to be equal for both CPU & memory, and you
|
||||
cannot add resource requirements to Best Effort pods.
|
||||
- Init containers and Ephemeral Containers cannot be resized.
|
||||
- Resource requests and limits cannot be removed once set.
|
||||
- A container's memory limit may not be reduced below its usage. If a request puts a container in
|
||||
this state, the resize status will remain in `InProgress` until the desired memory limit becomes
|
||||
feasible.
|
||||
- Windows pods cannot be resized.
|
||||
-->
|
||||
- 仅 CPU 和内存资源可以被更改。
|
||||
- Pod QoS 类不能更改。这意味着 Guaranteed Pod 的 requests 必须继续等于其 limits,
|
||||
Burstable Pod 对于 CPU 和内存的 requests 不能设为等于其 limits,
|
||||
并且你不能给 BestEffort Pod 添加资源要求。
|
||||
- Init 容器和临时容器不能调整大小。
|
||||
- 资源请求和限制一旦被设置就不能移除。
|
||||
- 容器的内存限制不可以低于其使用量。如果某请求将容器置于此状态,
|
||||
调整的状态将停留在 `InProgress`,直到预期的内存限制成为可行为止。
|
||||
- Windows Pod 不能被调整大小。
|
||||
|
||||
<!--
|
||||
## Create a pod with resource requests and limits
|
||||
|
||||
|
|
@ -240,9 +288,6 @@ spec:
|
|||
name: qos-demo-ctr-5
|
||||
ready: true
|
||||
...
|
||||
allocatedResources:
|
||||
cpu: 700m
|
||||
memory: 200Mi
|
||||
resources:
|
||||
limits:
|
||||
cpu: 700m
|
||||
|
|
@ -284,7 +329,7 @@ Now, patch the Pod's Container with CPU requests & limits both set to `800m`:
|
|||
现在对 Pod 的 Container 执行 patch 命令,将容器的 CPU 请求和限制均设置为 `800m`:
|
||||
|
||||
```shell
|
||||
kubectl -n qos-example patch pod qos-demo-5 --patch '{"spec":{"containers":[{"name":"qos-demo-ctr-5", "resources":{"requests":{"cpu":"800m"}, "limits":{"cpu":"800m"}}}]}}'
|
||||
kubectl -n qos-example patch pod qos-demo-5 --subresource resize --patch '{"spec":{"containers":[{"name":"qos-demo-ctr-5", "resources":{"requests":{"cpu":"800m"}, "limits":{"cpu":"800m"}}}]}}'
|
||||
```
|
||||
|
||||
<!--
|
||||
|
|
@ -315,9 +360,6 @@ spec:
|
|||
...
|
||||
containerStatuses:
|
||||
...
|
||||
allocatedResources:
|
||||
cpu: 800m
|
||||
memory: 200Mi
|
||||
resources:
|
||||
limits:
|
||||
cpu: 800m
|
||||
|
|
@ -330,18 +372,13 @@ spec:
|
|||
```
|
||||
|
||||
<!--
|
||||
Observe that the `allocatedResources` values have been updated to reflect the new
|
||||
desired CPU requests. This indicates that node was able to accommodate the
|
||||
increased CPU resource needs.
|
||||
|
||||
In the Container's status, updated CPU resource values shows that new CPU
|
||||
resources have been applied. The Container's `restartCount` remains unchanged,
|
||||
Observe that the `resources` in the `containerStatuses` have been updated to reflect the new desired
|
||||
CPU requests. This indicates that node was able to accommodate the increased CPU resource needs,
|
||||
and the new CPU resources have been applied. The Container's `restartCount` remains unchanged,
|
||||
indicating that container's CPU resources were resized without restarting the container.
|
||||
-->
|
||||
观察到 `allocatedResources` 的值已更新,反映了新的预期 CPU 请求。
|
||||
这表明节点能够容纳提高后的 CPU 资源需求。
|
||||
|
||||
在 Container 状态中,更新的 CPU 资源值显示已应用新的 CPU 资源。
|
||||
这表明节点能够容纳提高后的 CPU 资源需求,而且新的 CPU 资源已经被应用。
|
||||
Container 的 `restartCount` 保持不变,表示已在无需重启容器的情况下调整了容器的 CPU 资源。
|
||||
|
||||
<!--
|
||||
|
|
@ -365,6 +402,8 @@ kubectl delete namespace qos-example
|
|||
* [Assign Memory Resources to Containers and Pods](/docs/tasks/configure-pod-container/assign-memory-resource/)
|
||||
|
||||
* [Assign CPU Resources to Containers and Pods](/docs/tasks/configure-pod-container/assign-cpu-resource/)
|
||||
|
||||
* [Assign Pod-level CPU and memory resources](/docs/tasks/configure-pod-container/assign-pod-level-resources/)
|
||||
-->
|
||||
### 对于应用开发人员
|
||||
|
||||
|
|
@ -372,6 +411,8 @@ kubectl delete namespace qos-example
|
|||
|
||||
* [为容器和 Pod 分配 CPU 资源](/zh-cn/docs/tasks/configure-pod-container/assign-cpu-resource/)
|
||||
|
||||
* [分配 Pod 级别的 CPU 和内存资源](/zh-cn/docs/tasks/configure-pod-container/assign-pod-level-resources/)
|
||||
|
||||
<!--
|
||||
### For cluster administrators
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue