Skip to content

Instantly share code, notes, and snippets.

@jonathanballs
Created March 7, 2019 11:12
Show Gist options
  • Save jonathanballs/71dd37409276bbd9fe2526bab867bfee to your computer and use it in GitHub Desktop.
Save jonathanballs/71dd37409276bbd9fe2526bab867bfee to your computer and use it in GitHub Desktop.
Bash script chaos mode
#!/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