Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save mike-weiner/fab69be11ee1fce26e0cdfe675866264 to your computer and use it in GitHub Desktop.

Select an option

Save mike-weiner/fab69be11ee1fce26e0cdfe675866264 to your computer and use it in GitHub Desktop.
Snippet to trigger a rolling restart of all deployments in a namespace.
# This snippet is used to do a rolling restart on all Kubernetes
# deployments in a namespace.
# Replace `<NAMESPACE>` with your desired namespace.
NS=<NAMESPACE>
kubectl get deployments -n "$NS" -o name | grep -v "<EXCLUDE-THIS-DEPLOYMENT>" | while read -r d; do
kubectl rollout restart -n "$NS" "$d"
sleep 0.1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment