Skip to content

Instantly share code, notes, and snippets.

@guitarrapc
Created July 11, 2024 16:37
Show Gist options
  • Save guitarrapc/8849a0595061baaff5d0ad67043753d9 to your computer and use it in GitHub Desktop.
Save guitarrapc/8849a0595061baaff5d0ad67043753d9 to your computer and use it in GitHub Desktop.
Restart deployments for all namesapces
#!/bin/bash
for nsfull in $(kubectl get ns -o name | grep -v -E "kube.*"); do
ns=$(echo $nsfull | cut -d "/" -f 2)
deploy=""
echo "# Running $ns"
for deploy in $(kubectl get deploy -o name | grep -E ".*"); do
if [[ "$deploy" == "" ]]; then
continue
fi
kubectl rollout restart $deploy -n $ns
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment