Skip to content

Instantly share code, notes, and snippets.

@tanmay-bhat
Created January 4, 2022 15:12
Show Gist options
  • Save tanmay-bhat/5a5db35c32da7750af4b58398ae930de to your computer and use it in GitHub Desktop.
Save tanmay-bhat/5a5db35c32da7750af4b58398ae930de to your computer and use it in GitHub Desktop.
Shell script to restart all deployments in all namespace except kube-system
#!/bin/bash
#if any namespace needs to be excluded, add that in grep section
ns=$(kubectl get ns --no-headers | grep -Ev 'kube-system|kube-public' | cut -d ' ' -f1 )
for namespace in $ns; do
kubectl -n $namespace rollout restart deploy
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment