Skip to content

Commit c4199a6

Browse files
authored
Merge pull request #48503 from tallclair/ippr
Update In-Place Pod Resize docs for v1.32
2 parents 0866f6c + 1a730fd commit c4199a6

File tree

3 files changed

+39
-26
lines changed

3 files changed

+39
-26
lines changed

content/en/docs/concepts/workloads/autoscaling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Mode | Description
7979

8080
#### Requirements for in-place resizing
8181

82-
{{< feature-state for_k8s_version="v1.27" state="alpha" >}}
82+
{{< feature-state feature_gate_name="InPlacePodVerticalScaling" >}}
8383

8484
Resizing a workload in-place **without** restarting the {{< glossary_tooltip text="Pods" term_id="pod" >}}
8585
or its {{< glossary_tooltip text="Containers" term_id="container" >}} requires Kubernetes version 1.27 or later.

content/en/docs/reference/node/kubelet-files.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ The name of a checkpoint file is `kubelet_internal_checkpoint` for [Device Manag
9494
If your cluster has
9595
[in-place Pod vertical scaling](/docs/concepts/workloads/autoscaling/#in-place-resizing)
9696
enabled ([feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
97-
name `InPlacePodVerticalScaling`), then the kubelet stores a local record of Pod status.
97+
name `InPlacePodVerticalScaling`), then the kubelet stores a local record of allocated Pod resources.
9898

9999
The file name is `pod_status_manager_state` within the kubelet base directory
100100
(`/var/lib/kubelet` by default on Linux; configurable using `--root-dir`).

content/en/docs/tasks/configure-pod-container/resize-container-resources.md

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,33 @@ to be enabled. The alternative is to delete the Pod and let the
2424
[workload controller](/docs/concepts/workloads/controllers/) make a replacement Pod
2525
that has a different resource requirement.
2626

27+
A resize request is made through the pod `/resize` subresource, which takes the full updated pod for
28+
an update request, or a patch on the pod object for a patch request.
29+
2730
For in-place resize of pod resources:
28-
- Container's resource `requests` and `limits` are _mutable_ for CPU
29-
and memory resources.
30-
- `allocatedResources` field in `containerStatuses` of the Pod's status reflects
31-
the resources allocated to the pod's containers.
32-
- `resources` field in `containerStatuses` of the Pod's status reflects the
33-
actual resource `requests` and `limits` that are configured on the running
34-
containers as reported by the container runtime.
35-
- `resize` field in the Pod's status shows the status of the last requested
31+
- A container's resource `requests` and `limits` are _mutable_ for CPU
32+
and memory resources. These fields represent the _desired_ resources for the container.
33+
- The `resources` field in `containerStatuses` of the Pod's status reflects the resources
34+
_allocated_ to the pod's containers. For running containers, this reflects the actual resource
35+
`requests` and `limits` that are configured as reported by the container runtime. For non-running
36+
containers, these are the resources allocated for the container when it starts.
37+
- The `resize` field in the Pod's status shows the status of the last requested
3638
pending resize. It can have the following values:
37-
- `Proposed`: This value indicates an acknowledgement of the requested resize
38-
and that the request was validated and recorded.
39+
- `Proposed`: This value indicates that a pod was resized, but the Kubelet has not yet processed
40+
the resize.
3941
- `InProgress`: This value indicates that the node has accepted the resize
4042
request and is in the process of applying it to the pod's containers.
4143
- `Deferred`: This value means that the requested resize cannot be granted at
4244
this time, and the node will keep retrying. The resize may be granted when
43-
other pods leave and free up node resources.
45+
other pods are removed and free up node resources.
4446
- `Infeasible`: is a signal that the node cannot accommodate the requested
4547
resize. This can happen if the requested resize exceeds the maximum
4648
resources the node can ever allocate for a pod.
49+
- `""`: An empty or unset value indicates that the last resize completed. This should only be the
50+
case if the resources in the container spec match the resources in the container status.
51+
52+
If a node has pods with an incomplete resize, the scheduler will compute the pod requests from the
53+
maximum of a container's desired resource requests, and it's actual requests reported in the status.
4754

4855

4956
## {{% heading "prerequisites" %}}
@@ -107,6 +114,21 @@ have changed, the container will be restarted in order to resize its memory.
107114
108115
<!-- steps -->
109116
117+
## Limitations
118+
119+
In-place resize of pod resources currently has the following limitations:
120+
121+
- Only CPU and memory resources can be changed.
122+
- Pod QoS Class cannot change. This means that requests must continue to equal limits for Guaranteed
123+
pods, Burstable pods cannot set requests and limits to be equal for both CPU & memory, and you
124+
cannot add resource requirements to Best Effort pods.
125+
- Init containers and Ephemeral Containers cannot be resized.
126+
- Resource requests and limits cannot be removed once set.
127+
- A container's memory limit may not be reduced below its usage. If a request puts a container in
128+
this state, the resize status will remain in `InProgress` until the desired memory limit becomes
129+
feasible.
130+
- Windows pods cannot be resized.
131+
110132

111133
## Create a pod with resource requests and limits
112134

@@ -159,9 +181,6 @@ spec:
159181
name: qos-demo-ctr-5
160182
ready: true
161183
...
162-
allocatedResources:
163-
cpu: 700m
164-
memory: 200Mi
165184
resources:
166185
limits:
167186
cpu: 700m
@@ -190,7 +209,7 @@ resources, you cannot change the QoS class in which the Pod was created.
190209
Now, patch the Pod's Container with CPU requests & limits both set to `800m`:
191210

192211
```shell
193-
kubectl -n qos-example patch pod qos-demo-5 --patch '{"spec":{"containers":[{"name":"qos-demo-ctr-5", "resources":{"requests":{"cpu":"800m"}, "limits":{"cpu":"800m"}}}]}}'
212+
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"}}}]}}'
194213
```
195214

196215
Query the Pod's detailed information after the Pod has been patched.
@@ -215,9 +234,6 @@ spec:
215234
...
216235
containerStatuses:
217236
...
218-
allocatedResources:
219-
cpu: 800m
220-
memory: 200Mi
221237
resources:
222238
limits:
223239
cpu: 800m
@@ -229,12 +245,9 @@ spec:
229245
started: true
230246
```
231247

232-
Observe that the `allocatedResources` values have been updated to reflect the new
233-
desired CPU requests. This indicates that node was able to accommodate the
234-
increased CPU resource needs.
235-
236-
In the Container's status, updated CPU resource values shows that new CPU
237-
resources have been applied. The Container's `restartCount` remains unchanged,
248+
Observe that the `resources` in the `containerStatuses` have been updated to reflect the new desired
249+
CPU requests. This indicates that node was able to accommodate the increased CPU resource needs,
250+
and the new CPU resources have been applied. The Container's `restartCount` remains unchanged,
238251
indicating that container's CPU resources were resized without restarting the container.
239252

240253

0 commit comments

Comments
 (0)