One-line Chaos Monkey πŸ’

Tyler Williams
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 :)

--

--

Tyler Williams
Tyler Williams

Written by Tyler Williams

14k gold slum computer wizard

No responses yet