Skip to content

Commit 932617d

Browse files
authored
Merge pull request #101130 from laurenhughes/manifest-hpa
Add manifest hpa instructions
2 parents 2336e8e + ff29d68 commit 932617d

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

articles/aks/tutorial-kubernetes-scale.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: mlearned
66

77
ms.service: container-service
88
ms.topic: tutorial
9-
ms.date: 12/19/2018
9+
ms.date: 01/14/2019
1010
ms.author: mlearned
1111
ms.custom: mvc
1212

@@ -98,6 +98,43 @@ The following example uses the [kubectl autoscale][kubectl-autoscale] command to
9898
kubectl autoscale deployment azure-vote-front --cpu-percent=50 --min=3 --max=10
9999
```
100100

101+
Alternatively, you can create a manifest file to define the autoscaler behavior and resource limits. The following is an example of a manifest file named `azure-vote-hpa.yaml`.
102+
103+
```yaml
104+
apiVersion: autoscaling/v1
105+
kind: HorizontalPodAutoscaler
106+
metadata:
107+
name: azure-vote-back-hpa
108+
spec:
109+
maxReplicas: 10 # define max replica count
110+
minReplicas: 3 # define min replica count
111+
scaleTargetRef:
112+
apiVersion: apps/v1
113+
kind: Deployment
114+
name: azure-vote-back
115+
targetCPUUtilizationPercentage: 50 # target CPU utilization
116+
117+
118+
apiVersion: autoscaling/v1
119+
kind: HorizontalPodAutoscaler
120+
metadata:
121+
name: azure-vote-front-hpa
122+
spec:
123+
maxReplicas: 10 # define max replica count
124+
minReplicas: 3 # define min replica count
125+
scaleTargetRef:
126+
apiVersion: apps/v1
127+
kind: Deployment
128+
name: azure-vote-front
129+
targetCPUUtilizationPercentage: 50 # target CPU utilization
130+
```
131+
132+
Use `kubectl apply` to apply the autoscaler defined in the `azure-vote-hpa.yaml` manifest file.
133+
134+
```
135+
$ kubectl apply -f azure-vote-hpa.yaml
136+
```
137+
101138
To see the status of the autoscaler, use the `kubectl get hpa` command as follows:
102139
103140
```

0 commit comments

Comments
 (0)