Skip to content

Commit bb52a03

Browse files
committed
updated article based on testing in lab
1 parent 28537b1 commit bb52a03

File tree

1 file changed

+80
-36
lines changed

1 file changed

+80
-36
lines changed

articles/aks/vertical-pod-autoscaler.md

Lines changed: 80 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Vertical Pod Autoscaling (preview) in Azure Kubernetes Service (AKS)
33
description: Learn how to vertically autoscale your pod on an Azure Kubernetes Service (AKS) cluster.
44
services: container-service
55
ms.topic: article
6-
ms.date: 09/22/2022
6+
ms.date: 09/27/2022
77
---
88

99
# Vertical Pod Autoscaling (preview) in Azure Kubernetes Service (AKS)
@@ -14,7 +14,7 @@ This article provides an overview of Vertical Pod Autoscaler (VPA) (preview) in
1414

1515
Vertical Pod Autoscaler provides the following benefits:
1616

17-
* It analyzes and adjusts processor and memory resources to *right size* your applications. VPA is not only responsible for scaling up, but also for scaling down based on their resource use over time.
17+
* It analyzes and adjusts processor and memory resources to *right size* your applications. VPA is not only responsible for scaling up, but also for scaling down based on their resource use over time.
1818

1919
* A Pod is evicted if it needs to change its resource requests based on if its scaling mode is set to *auto*
2020

@@ -29,14 +29,16 @@ Vertical Pod Autoscaler provides the following benefits:
2929
## Limitations
3030

3131
* Vertical Pod autoscaling supports a maximum of 500 `VerticalPodAutoscaler` objects per cluster.
32-
* With this preview release, you cannot change the `controllerValue` and `updateMode` fields.
32+
* With this preview release, you cannot change the `controllerValue` and `updateMode` properties. While you can see them from the `managedCluster` object, they are reserved for future use.
3333

3434
## Before you begin
3535

36-
* You have an existing AKS cluster. If you don't, see [Getting started with Azure Kubernetes Service][get-started-with-aks].
36+
* Your AKS cluster is running Kubernetes version 1.22 and higher.
3737

3838
* The Azure CLI version 2.0.64 or later installed and configured. Run `az --version` to find the version. If you need to install or upgrade, see [Install Azure CLI][install-azure-cli].
3939

40+
* The `aks-preview` extension version 0.5.102 or later.
41+
4042
* `kubectl` should be connected to the cluster you want to install VPA.
4143

4244
## API Object
@@ -50,7 +52,7 @@ The Virtical Pod Autoscaler is an API resource in the Kubernetes autoscaling API
5052
To install the aks-vpapreview preview feature, run the following command:
5153

5254
```azurecli
53-
az feature register Microsoft.ContainerService/AKS-VPAPreview
55+
az feature register --namespace Microsoft.ContainerService --name AKS-VPAPreview
5456
```
5557

5658
## Deploy, upgrade, or disable VPA on a cluster
@@ -87,6 +89,15 @@ In this section, you deploy, upgrade, or disable the Vertical Pod Autoscaler on
8789
kubectl get pods -n kube-system
8890
```
8991

92+
The output of the command includes the following results specific to the VPA pods. The pods should show a *running* status.
93+
94+
```output
95+
NAME READY STATUS RESTARTS AGE
96+
vpa-admission-controller-7867874bc5-vjfxk 1/1 Running 0 41m
97+
vpa-recommender-5fd94767fb-ggjr2 1/1 Running 0 41m
98+
vpa-updater-56f9bfc96f-jgq2g 1/1 Running 0 41m
99+
```
100+
90101
## Test your Vertical Pod Autoscaler installation
91102

92103
The following steps create a deployment with two pods, each running a single container that requests 100 millicores and tries to utilize slightly above 500 millicores. Also created is a VPA config pointing at the deployment. The VPA observes the behavior of the pods, and after about five minutes, they are updated with a higher CPU request.
@@ -110,25 +121,43 @@ The following steps create a deployment with two pods, each running a single con
110121
The example output resembles the following:
111122

112123
```bash
113-
hamster-c7d89d6db-rglf5 1/1 Running 0 48s
114-
hamster-c7d89d6db-znvz5 1/1 Running 0 48s
124+
hamster-78f9dcdd4c-hf7gk 1/1 Running 0 24s
125+
hamster-78f9dcdd4c-j9mc7 1/1 Running 0 24s
115126
```
116127

117-
1. Use the [kubectl describe][kubectl-describe] command on one of the pods to view its CPU and memory reservation. Replace "example ID" with one of the IDs returned in your output from the previous step.
128+
1. Use the [kubectl describe][kubectl-describe] command on one of the pods to view its CPU and memory reservation. Replace "exampleID" with one of the pod IDs returned in your output from the previous step.
118129

119130
```bash
120-
kubectl describe pod hamster-<exampleID>
131+
kubectl describe pod hamster-exampleID
121132
```
122133

123-
The example output resembles the following:
134+
The example output is a snippet of the information about the cluster:
124135

125136
```bash
126-
137+
hamster:
138+
Container ID: containerd://
139+
Image: k8s.gcr.io/ubuntu-slim:0.1
140+
Image ID: sha256:
141+
Port: <none>
142+
Host Port: <none>
143+
Command:
144+
/bin/sh
145+
Args:
146+
-c
147+
while true; do timeout 0.5s yes >/dev/null; sleep 0.5s; done
148+
State: Running
149+
Started: Wed, 28 Sep 2022 15:06:14 -0400
150+
Ready: True
151+
Restart Count: 0
152+
Requests:
153+
cpu: 100m
154+
memory: 50Mi
155+
Environment: <none>
127156
```
128157

129158
The pod has 100 millicpu and 50 Mibibytes of memory reserved in this example. For this sample application, the pod needs less than 100 millicpu to run, so there is no CPU capacity available. The pods also reserves much less memory than needed. The Vertical Pod Autoscaler *vpa-recommender* deployment analyzes the pods hosting the hamster application to see if the CPU and memory requirements are appropriate. If adjustments are needed, the vpa-updater relaunches the pods with updated values.
130159

131-
1. Wait for the vpa-updater to launch a new hamster pod. This should take a minute or two. You can monitor the pods using the [kubectl get][kubectl-get] command.
160+
1. Wait for the vpa-updater to launch a new hamster pod. This should take a few minutes. You can monitor the pods using the [kubectl get][kubectl-get] command.
132161

133162
```bash
134163
kubectl get --watch pods -l app=hamster
@@ -140,10 +169,17 @@ The following steps create a deployment with two pods, each running a single con
140169
kubectl describe pod hamster-<exampleID>
141170
```
142171

143-
The example output resembles the following:
172+
The example output is a snippet of the information describing the pod:
144173

145174
```bash
146-
175+
State: Running
176+
Started: Wed, 28 Sep 2022 15:09:51 -0400
177+
Ready: True
178+
Restart Count: 0
179+
Requests:
180+
cpu: 587m
181+
memory: 262144k
182+
Environment: <none>
147183
```
148184

149185
In the previous output, you can see that the CPU reservation increased to 587 millicpu, which is over five times the original value. The memory increased to 262,144 Kilobytes, which is around 250 Mibibytes, or five times the original value. This pod was under-resourced, and the Vertical Pod Autoscaler corrected the estimate with a much more appropriate value.
@@ -154,10 +190,17 @@ The following steps create a deployment with two pods, each running a single con
154190
kubectl describe vpa/hamster-vpa
155191
```
156192

157-
The example output resembles the following:
193+
The example output is a snippet of the information about the resource utilization:
158194

159195
```bash
160-
196+
State: Running
197+
Started: Wed, 28 Sep 2022 15:09:51 -0400
198+
Ready: True
199+
Restart Count: 0
200+
Requests:
201+
cpu: 587m
202+
memory: 262144k
203+
Environment: <none>
161204
```
162205

163206
## Set Pod Autoscaler requests automatically
@@ -174,29 +217,30 @@ Vertical Pod autoscaling uses the `VerticalPodAutoscaler` object to automaticall
174217

175218
```yml
176219
apiVersion: apps/v1
177-
kind: Deployment
178-
metadata:
179-
name: azure-autodeploy
180-
spec:
181-
replicas: 2
182-
selector:
183-
matchLabels:
184-
app: azure-autodeploy
185-
template:
220+
kind: Deployment
186221
metadata:
187-
labels:
188-
app: azure-autodeploy
222+
name: azure-autodeploy
189223
spec:
190-
containers:
191-
- name: mycontainer
192-
image: mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpine
193-
resources:
194-
requests:
195-
cpu: 100m
196-
memory: 50Mi
197-
command: ["/bin/sh"]
198-
args: ["-c", "while true; do timeout 0.5s yes >/dev/null; sleep 0.5s; done"]
224+
replicas: 2
225+
selector:
226+
matchLabels:
227+
app: azure-autodeploy
228+
template:
229+
metadata:
230+
labels:
231+
app: azure-autodeploy
232+
spec:
233+
containers:
234+
- name: mycontainer
235+
image: mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpine
236+
resources:
237+
requests:
238+
cpu: 100m
239+
memory: 50Mi
240+
command: ["/bin/sh"]
241+
args: ["-c", "while true; do timeout 0.5s yes >/dev/null; sleep 0.5s; done"]
199242
```
243+
200244
This manifest describes a deployment that has two Pods. Each Pod has one container that requests 100 milliCPU and 50 MiB of memory.
201245

202246
3. Create the pod with the [kubectl create][kubectl-create] command, as shown in the following example:

0 commit comments

Comments
 (0)