Kubernetes Restart Container / Reload Container Settings

Quote from moshe on 02/11/2020, 8:49 amProblem
User wants to restart entire container ( with all pods )
Solution
Method 1 – Delete container. kubernetes will restore it with settings
kubectl delete pod -n=kube-system coredns-fb8b8dccf-8ggcf
Method 2 – Scale Down and scale up deployment
kubectl scale deployment <<name>> –replicas=0 -n <<namespace>>
kubectl scale deployment <<name>> –replicas=1 -n <<namespace>>
Example method 2
kubectl scale deployment zipkin –replicas=0 -n monitoring
kubectl scale deployment zipkin –replicas=1 -n monitoringkubectl scale deployment github-actions-runner-operator –replicas=0 -n github-actions-runner-operator –all
kubectl scale deployment github-actions-runner-operator –replicas=1 -n github-actions-runner-operator –all
Example 3
Scale all statefulsets and deployments under the namespace
kubectl scale statefulset,deployment -n github-actions-runner-operator –all –replicas=0
kubectl scale statefulset,deployment -n github-actions-runner-operator –all –replicas=1
Problem
User wants to restart entire container ( with all pods )
Solution
Method 1 – Delete container. kubernetes will restore it with settings
kubectl delete pod -n=kube-system coredns-fb8b8dccf-8ggcf
Method 2 – Scale Down and scale up deployment
kubectl scale deployment <<name>> –replicas=0 -n <<namespace>>
kubectl scale deployment <<name>> –replicas=1 -n <<namespace>>
Example method 2
kubectl scale deployment zipkin –replicas=0 -n monitoring
kubectl scale deployment zipkin –replicas=1 -n monitoringkubectl scale deployment github-actions-runner-operator –replicas=0 -n github-actions-runner-operator –all
kubectl scale deployment github-actions-runner-operator –replicas=1 -n github-actions-runner-operator –all
Example 3
Scale all statefulsets and deployments under the namespace
kubectl scale statefulset,deployment -n github-actions-runner-operator –all –replicas=0
kubectl scale statefulset,deployment -n github-actions-runner-operator –all –replicas=1

Quote from moshe on 24/05/2021, 7:34 pmyou can scale down multiple deployments faster using the following commands in the namespace
kubectl scale deployment $(kubectl get deployment |grep -v NAME|awk ‘{print $1}’|tr ‘\n’ ‘ ‘) –replicas=0
or specify multiple deployments with spaces between them
you can scale down multiple deployments faster using the following commands in the namespace
kubectl scale deployment $(kubectl get deployment |grep -v NAME|awk ‘{print $1}’|tr ‘\n’ ‘ ‘) –replicas=0
or specify multiple deployments with spaces between them