Created
October 7, 2016 10:38
-
-
Save ikuwow/5e8b180b89aba320dca657d9d0602dcd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Randomly choose pods, and kubectl exec | |
# usage ./kubeexec.sh hostname | |
pod_count=$(kubectl get pods -o name | wc -l) | |
pod_index=`echo "scale=0; $pod_count * $RANDOM / 32767 + 1" | bc` | |
pod=$(kubectl get pods -o name | awk "NR==$pod_index" | sed -e 's/pod\///g') | |
/usr/local/bin/kubectl exec $pod $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment