Skip to content

Commit 994c475

Browse files
authored
Merge pull request #31849 from mburke5678/node-min-replica-vpa
Allow min-replicas=1 for the Vertical Pod Autoscaler
2 parents ad0af0f + 253c16f commit 994c475

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

modules/nodes-pods-vertical-autoscaler-about.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ The VPA automatically computes historic and current CPU and memory usage for the
1111

1212
The VPA automatically deletes any pods that are out of alignment with its recommendations one at a time, so that your applications can continue to serve requests with no downtime. The workload objects then re-deploy the pods with the original resource limits and requests. The VPA uses a mutating admission webhook to update the pods with optimized resource limits and requests before the pods are admitted to a node. If you do not want the VPA to delete pods, you can view the VPA resource limits and requests and manually update the pods as needed.
1313

14+
[NOTE]
15+
====
16+
By default, workload objects must specify a minimum of two replicas in order for the VPA to automatically delete their pods. Workload objects that specify fewer replicas than this minimum are not deleted. If you manually delete these pods, when the workload object redeploys the pods, the VPA does update the new pods with its recommendations. You can change this minimum by modifying the `VerticalPodAutoscalerController` object as shown shown in _Changing the VPA minimum value_.
17+
====
18+
1419
For example, if you have a pod that uses 50% of the CPU but only requests 10%, the VPA determines that the pod is consuming more CPU than requested and deletes the pod. The workload object, such as replica set, restarts the pods and the VPA updates the new pod with its recommended resources.
1520

1621
For developers, you can use the VPA to help ensure your pods stay up during periods of high demand by scheduling pods onto nodes that have appropriate resources for each pod.

modules/nodes-pods-vertical-autoscaler-using-about.adoc

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,40 @@ The output shows the recommended resources, `target`, the minimum recommended re
9191

9292
The VPA uses the `lowerBound` and `upperBound` values to determine if a pod needs to be updated. If a pod has resource requests below the `lowerBound` values or above the `upperBound` values, the VPA terminates and recreates the pod with the `target` values.
9393

94+
[id="nodes-pods-vertical-autoscaler-using-one-pod_{context}"]
95+
== Changing the VPA minimum value
96+
97+
By default, workload objects must specify a minimum of two replicas in order for the VPA to automatically delete and update their pods. As a result, workload objects that specify fewer than two replicas are not automatically acted upon by the VPA. The VPA does update new pods from these workload objects if the pods are restarted by some process external to the VPA. You can change this cluster-wide minimum value by modifying the `minReplicas` parameter in the `VerticalPodAutoscalerController` custom resource (CR).
98+
99+
For example, if you set `minReplicas` to `3`, the VPA does not delete and update pods for workload objects that specify fewer than three replicas.
100+
101+
[NOTE]
102+
====
103+
If you set `minReplicas` to `1`, the VPA can delete the only pod for a workload object that specifies only one replica. You should use this setting with one-replica objects only if your workload can tolerate downtime whenever the VPA deletes a pod to adjust its resources. To avoid unwanted downtime with one-replica objects, configure the VPA CRs with the `podUpdatePolicy` set to `Initial`, which automatically updates the pod only when it is restarted by some process external to the VPA, or `Off`, which allows you to update the pod manually at an appropriate time for your application.
104+
====
105+
106+
.Example `VerticalPodAutoscalerController` object
107+
[source,yaml]
108+
----
109+
apiVersion: autoscaling.openshift.io/v1
110+
kind: VerticalPodAutoscalerController
111+
metadata:
112+
creationTimestamp: "2021-04-21T19:29:49Z"
113+
generation: 2
114+
name: default
115+
namespace: openshift-vertical-pod-autoscaler
116+
resourceVersion: "142172"
117+
uid: 180e17e9-03cc-427f-9955-3b4d7aeb2d59
118+
spec:
119+
minReplicas: 3 <1>
120+
podMinCPUMillicores: 25
121+
podMinMemoryMb: 250
122+
recommendationOnly: false
123+
safetyMarginFraction: 0.15
124+
----
125+
126+
<1> Specify the minimum number of replicas in a workload object for the VPA to act on. Any objects with replicas fewer than the minimum are not automatically deleted by the VPA.
127+
94128
[id="nodes-pods-vertical-autoscaler-using-auto_{context}"]
95129
== Automatically applying VPA recommendations
96130
To use the VPA to automatically update pods, create a VPA CR for a specific workload object with `updateMode` set to `Auto` or `Recreate`.
@@ -99,7 +133,7 @@ When the pods are created for the workload object, the VPA constantly monitors t
99133

100134
[NOTE]
101135
====
102-
The workload object must specify a minimum of two replicas in order for the VPA to monitor and update the pods. If the workload object specifies one replica, the VPA does not delete the pod to prevent application downtime. You can manually delete the pod to use the recommended resources.
136+
By default, workload objects must specify a minimum of two replicas in order for the VPA to automatically delete their pods. Workload objects that specify fewer replicas than this minimum are not deleted. If you manually delete these pods, when the workload object redeploys the pods, the VPA does update the new pods with its recommendations. You can change this minimum by modifying the `VerticalPodAutoscalerController` object as shown shown in _Changing the VPA minimum value_.
103137
====
104138

105139
.Example VPA CR for the `Auto` mode

0 commit comments

Comments
 (0)