One-line Chaos Monkey π
1 min readSep 28, 2020
All apologies.
for (( ; ; )) do pod2kill=$(kubectl get pods β namespace=YOUR_NAMESPACE | tail -n +2 | awk β{print $1}β | sort -R | tail -1); echo βKilling pod: ${pod2kill}β¦β && kubectl β namespace=YOUR_NAMESPACE delete pod ${pod2kill} && sleep 20; done
This is not a very good chaos-monkey for a million reasons (it always kills machines politely, it only hits in one namespace, happens on a regular period, etc, etc) but it has been a useful tool for me as we make our app more resilient to server restarts :)