CoreDNS is a flexible, extensible DNS server that can serve as the Kubernetes cluster DNS.
When ever the server restart or new dns entry needs to be done for the kubernetes cluster follow the below steps:
In the master node create hostfile-cm.yaml file and add the below content.
Bangalore
apiVersion: v1 |
Gujarat
apiVersion: v1 |
Mangalore
apiVersion: v1 |
Apply the configuration.
kubectl apply -f hostfile-cm.yaml |
Get the pod name of coredns.
kubectl -n kube-system get po |
Delete the pod so that the coredns deployment recreates it by loading the coredns-custom configmap in the process.
kubectl -n kube-system delete po <coredns-pod-name> |
Execute the below command to ssh into any pod other than coredns pod.
kubectl -n kube-system exec --stdin --tty <traefik_pod_name> -- /bin/sh |
Then try pinging the domain names.
If ping is not there then install it using the below commands.
apt update |
apt install -y iputils-ping |