If you would like to run shell commands inside of your Kubernetes cluster, then you can use the kubectl run
command.
What the syntax looks like
kubectl run --image=<imagename> <name> -restart=Never -it --rm -- /bin/sh -c "<command>"
Breaking this down, you pass in an imagename
which is the container image you would like to execute the commands in, the name
of this temporary container, and then command
you would like to run in it.
The -it
indicates that it is an interactive command, while --rm
tells the container to not persist once it has completed execution.
An example command
kubectl run --image=busybox bbox1 --restart=Never -it --rm -- /bin/sh -c "wget -q0 http://12.34.56.78/"
Note that the IP above 12.34.56.78
should be swapped out with the IP address you want to run wget
against. You can get your Cluster IP by running kuebctl get svc
.