If you would like to test hpa
, Horizontal Pod Autoscaling, or throw some chaos at a specific deployment in Kubernetes
, then you could run a Load Generator
Step 1 – Run a BusyBox container
The following command will use a busybox
container and dump you into it’s shell window:
kubectl run -i --tty load-generator --image=busybox /bin/sh
As an alternative, you could also run:
kubectl --generator=run-pod/v1 run -i --tty load-generator --image=busybox /bin/sh
Step 2 – Run a wget
loop
You can now trigger a wget
loop to make HTTP request calls to your deployment:
while true; do wget -q -O - http://php-apache; done
The above command makes calls to a php-apache
deployment.
Step 3 – Finding your deployment
You can swap out the above http://php-apache
URL by finding out what your deployment is called. The following code will let you know the name of the deployments available in your cluster:
kubectl get deploy