Main Menu

Search

KUBERNETES: How To Delete CoreDNS ConfigMap & Reload It & Start CoreDNS Pods?

KUBERNETES: How To Delete CoreDNS ConfigMap & Reload It & Start CoreDNS Pods?

Below are steps. This procedure will be helpful in case there is some corrupt coredns configmap. It is important to take backups before proceeding with this procedure.

1) Capture the coredns config map in yaml format.

kubectl -n kube-system get configmap coredns -o yaml > coredns.yaml

2) Take backup of coredns config map.

cp coredns.yaml coredns.yaml.orig

3) Delete coredns config map.

kubectl delete configmap coredns -n kube-system

4) Delete the coredns pods.

kubectl get pods -n kube-system

Above command will still list the coredns pods

kubectl delete pod <coredns pod> -n kube-system

delete all the coredns pods using above command.

kubectl get pods -n kube-system

core dns pods will be in container creating status and will stay in that state from above command output.

5) Reload coredns config map from the yaml file captured in above steps 1.

kubectl apply -f coredns.yaml

6) Check the coredns pods.

kubectl get pods -n kube-system

container creating coredns pods will come into running state.

No comments:

Post a Comment