What version of k8s are you using? I’m using 1.15.3 and the commands I
listed work properly. You can see the pods in the nginx deployment get
terminated and recreated when I run kubectl rollout restart here:
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-deployment-57f8b7cdfb-54s4b 1/1 Running 0 22h
nginx-deployment-57f8b7cdfb-5b5dd 1/1 Running 0 22h
$ deploys=`kubectl get deployments | tail -n1 | cut -d ' ' -f 1`
$ for deploy in $deploys; do kubectl rollout restart
deployments/$deploy; done
deployment.extensions/nginx-deployment restarted
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-deployment-75cfbd6cf5-nvqhc 1/1 Running 0 20s
nginx-deployment-75cfbd6cf5-tdfw2 1/1 Running 0 21s
Note that I don’t have an “apps” namespace, so I left off “-n apps” to
use the default namespace. Other than that, it’s the exact commands I’d
listed.
Best,
-jay