Forum Navigation
You need to log in to create posts and topics.

Kubernetes Restart Container / Reload Container Settings

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 monitoring

kubectl 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

 

 

 

 

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