You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
+
101
138
To see the status of the autoscaler, use the `kubectl get hpa` command as follows:
0 commit comments