Skip to content

How to Run a Load Generator on Kubernetes

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
Code language: Bash (bash)

As an alternative, you could also run:

kubectl --generator=run-pod/v1 run -i --tty load-generator --image=busybox /bin/sh
Code language: Bash (bash)

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
Code language: Bash (bash)

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
Code language: Bash (bash)

See also  How to Solve a Pandigital Sequence in Java
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x