This command creates an HPA with a minimum of one pod and maximum of ten pods running. It will try to keep the averga usage of the pods at 50% and if there is more usage, it will automatically create more pods to keep the usage at 50%.
To test it, run the following on a different terminal
kubectl run -it --rm load-generator --image=busybox /bin/sh
Then, to create the trafic neede for the HPA start working.
**while true; do wget -q -O- http://php-apache; done**
Back on the first terminal, monitor the HPA with
kubectl get hpa -w
To have more control over the HPA we can also create it with a mainfest file, the equivalent to the command kubectl autoscale deployment php-apache --cpu-percent=50 --min=1 --max=10 would be:
HPA can also be configured depending on the cpu usage or requests recieved, it is a good idea save it as a file to keeep record of the configuration for the HPA.