Files
SearchServices/e2e-test/qa/chaos/kubernetes-pod-chaos-monkey/chaos.sh
Lucian Suciu 93516a8a2c chaos monkey
2019-03-25 11:30:37 +02:00

18 lines
383 B
Bash
Executable File

#!/bin/bash
# Randomly delete pods in a Kubernetes namespace.
set -ex
while true
do
kubectl \
--namespace "${NAMESPACE}" \
-o 'jsonpath={.items[*].metadata.name}' \
get pods | \
tr " " "\n" | \
shuf | \
head -n ${KILL_NR} |
xargs -t --no-run-if-empty \
kubectl --namespace "${NAMESPACE}" delete pod
sleep "${DELAY_SEC}"
done