Skip to content

Instantly share code, notes, and snippets.

@tcotav
Last active November 28, 2017 00:33
Show Gist options
  • Save tcotav/147fb26693e565918adcde9e87d36dca to your computer and use it in GitHub Desktop.
Save tcotav/147fb26693e565918adcde9e87d36dca to your computer and use it in GitHub Desktop.
Kubernetes -- delete all current pods in an RC so they can be replaced
#!/bin/bash
if [ -z "$1" ]
then
echo "requires base pod-name for grep"
exit 1
fi
if [ ! -z "$2" ]
then
NS=--namespace=${2}
fi
kubectl get pod ${NS} | grep ^$1 | cut -d " " -f1 - | xargs -n1 -P 10 kubectl delete pod ${NS}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment