On-Prem k8s | Part 10

Deploying Cluster Add-ons


CoreDNS is a dns server written in Go. It is a Cloud Native Computing Foundation incubating project and an eventual replacement to kube-dns. It has been promoted to beta with Kubernetes 1.10.

CoreDNS is configured through a Corefile, and in Kubernetes, we will use a ConfigMap

We will simply deploy it using the following manifest file

kubectl apply -f https://raw.githubusercontent.com/mch1307/k8s-thw/master/coredns.yaml
serviceaccount "coredns" created
clusterrole.rbac.authorization.k8s.io "system:coredns" created
clusterrolebinding.rbac.authorization.k8s.io "system:coredns" created
configmap "coredns" created
deployment.extensions "coredns" created
service "kube-dns" created


Verify pods are up and running:

kubectl get pod --all-namespaces -l k8s-app=coredns -o wide
NAMESPACE     NAME                       READY     STATUS    RESTARTS   AGE       IP             NODE
kube-system   coredns-85646c4d6b-2bhzf   1/1       Running   0          9m   k8swrk1
kube-system   coredns-85646c4d6b-2cdgq   1/1       Running   0          3m     k8swrk2

Verify DNS resolution:

Launch a simple busybox deployment:

kubectl run busybox --image=busybox --command -- sleep 3600

Get the pod’s exact name:

POD_NAME=$(kubectl get pods -l run=busybox -o jsonpath="{.items[0].metadata.name}")

Check DNS resolution from within the busybox pod:

kubectl exec -ti $POD_NAME -- nslookup kubernetes
Address 1: kube-dns.kube-system.svc.cluster.local

Name:      kubernetes
Address 1: kubernetes.default.svc.cluster.local

Next: Kubernetes Cluster Conformance >

< Configuring Networking

  • Category
comments powered by Disqus