Created
March 7, 2019 11:12
-
-
Save jonathanballs/71dd37409276bbd9fe2526bab867bfee to your computer and use it in GitHub Desktop.
Bash script chaos mode
This file contains 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 | |
# Deletes one random pod from kubernetes every DELAY seconds | |
DELAY=0 | |
while true; do | |
POD=$(kubectl get pods -o json | jq -r '.items[].metadata.name' | grep -v backend | grep -v frontend | shuf | head -n1) | |
# Log with pod name in bold | |
echo -e "$(date) -- Killing pod \e[1m$POD\e[0m" | |
kubectl delete pod $POD > /dev/null | |
sleep $DELAY | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment