Skip to content

Commit 19f7001

Browse files
committed
Add feedback from Stefan and Sandor
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent 5eb9963 commit 19f7001

File tree

1 file changed

+8
-40
lines changed

1 file changed

+8
-40
lines changed

Diff for: docs/tutorials/kubernetes-hpa.md

+8-40
Original file line numberDiff line numberDiff line change
@@ -97,38 +97,6 @@ Disable auto-scaling by scaling alertmanager down to zero replicas, this will st
9797
kubectl scale -n openfaas deploy/alertmanager --replicas=0
9898
```
9999

100-
### Configure Prometheus to scrape the Kubernetes API server
101-
102-
The metrics available via kubectl top / pod can now be scraped with Prometheus. OpenFaaS ships with Prometheus, and you could reconfigure that version to do this task, but for the tutorial we will install it again.
103-
104-
```
105-
kubectl create namespace prometheus
106-
107-
helm install stable/prometheus \
108-
--name prometheus \
109-
--namespace prometheus \
110-
--set alertmanager.persistentVolume.enabled=false,server.persistentVolume.enabled=false,pushgateway.enabled=false
111-
```
112-
113-
You will see that a number of pods have been created including "node-exporter" which fetches statistics about each node such as free disk space and CPU utilization.
114-
115-
```
116-
kubectl get pods -n prometheus
117-
```
118-
119-
Now port-forward the Prometheus dashboard:
120-
121-
```
122-
kubectl --namespace=prometheus port-forward deploy/prometheus-server 9090
123-
```
124-
125-
From here you can open a browser at `http://127.0.0.1:9090`
126-
127-
Prometheus has been configured to use the Kubernetes service discovery mechanism. It will find any Pods with metrics then scrape them.
128-
129-
* See your targets at: http://127.0.0.1:9090/targets
130-
* Enter query such as `container_memory_usage_bytes` on the Graph page.
131-
132100
### Deploy your first function
133101

134102
For HPAv2 to work, we need to deploy a function with a minimum request value for CPU.
@@ -190,7 +158,7 @@ horizontalpodautoscaler.autoscaling/nodeinfo autoscaled
190158

191159
View the HPA record with:
192160

193-
```
161+
```sh
194162
kubectl get hpa/nodeinfo -n openfaas-fn
195163

196164
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
@@ -203,7 +171,7 @@ kubectl get hpa/nodeinfo -n openfaas-fn -o yaml
203171

204172
You can use `kubectl describe hpa/nodeinfo -n openfaas-fn` to get detailed information including any events such as scaling up and down.
205173

206-
```
174+
```sh
207175
kubectl describe hpa/nodeinfo -n openfaas-fn
208176

209177
Name: nodeinfo
@@ -230,7 +198,7 @@ Events: <none>
230198

231199
Use the following command with hey
232200

233-
```
201+
```sh
234202
export OPENFAAS_URL=http://127.0.0.1:31112
235203

236204
hey -c 5 \
@@ -245,23 +213,23 @@ You should note that HPA is designed to react slowly to changes in traffic, both
245213

246214
Now in a new window monitor the progress:
247215

248-
```
216+
```sh
249217
kubectl describe hpa/nodeinfo -n openfaas
250218
```
251219

252220
Or in an automated fashion:
253221

254-
```
222+
```sh
255223
# watch -n 5 "kubectl describe hpa/nodeinfo -n openfaas-fn"
256224
```
257225

258226
You can also monitor the replicas of your function in the OpenFaaS UI or via the CLI:
259227

260-
```
228+
```sh
261229
watch -n 5 "faas-cli list"
262230
```
263231

264-
Here is ane example of the replicas scaling up in response to the traffic created by `hey`:
232+
Here is an example of the replicas scaling up in response to the traffic created by `hey`:
265233

266234
```sh
267235
Name: nodeinfo
@@ -292,7 +260,7 @@ Note that whilst the scaling up was relatively quick, the scale-down may take si
292260

293261
## 3. Wrapping up
294262

295-
In this tutorial we disabled the auto-scaling built into OpenFaaS which uses Prometheus and Alertmanager, and added in Kubernetes' own HPAv2 mechanism, its metrics-server and another deployment of Prometheus.
263+
In this tutorial we disabled the auto-scaling built into OpenFaaS which uses Prometheus and Alertmanager, and added in Kubernetes' own HPAv2 mechanism and its metrics-server.
296264

297265
### Notes and caveats
298266

0 commit comments

Comments
 (0)