NOTE
Below example is for only default
namespace.
- add
-n
option for specific namespace - add
-A
option for all namespaces
1#!/bin/bash
2
3allPods=($(kubectl get deployments | awk 'NR!=1 {print $1}'))
4
5ind=1
6for i in "${allPods[@]}"
7do
8 echo "$ind --> restarting $i"
9 kubectl rollout restart deployment $i
10 echo ""
11 # sleep 10
12 ((ind+=1))
13done