DNS issue in K8s cluster while dealing with multiple namespaces

6/11/2019

We have a K8s cluster(1 master, 3 nodes) with multiple namespaces created. All pods are in Running state including coredns in kube-system. We face "host name cannot be resolved" kind of error sometimes(mostly when scale up/down the pods). When we check the coredns logs, got the following error

reflector.go:205] github.com/coredns/coredns/plugin/kubernetes/controller.go:318: Failed to list /*v1.Namespace: namespaces is forbidden: User "system:serviceaccount:kube-system:coredns" cannot list resource "namespaces" in API group "" at the cluster scope

We were not getting any error when there was only one default namespace.

K8s cluster initialized with the following command:

kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=10.50.122.204

Network: Flannel kubectl,kubelet,kebeadm version: 1.13.3

Do we need to do anything specific for network or dns side when creating multiple namespaces? Ideally, pods should be able to resolve the service name. Thanks in advance.

Update: Issue got fixed by changing the base image of Docker. I was using the base image which is having some security restrictions (image from private registry).

-- Skp
coredns
kubernetes
namespaces

0 Answers