In this lab you will deploy the DNS add-on which provides DNS based service discovery, backed by CoreDNS, to applications running inside the Kubernetes cluster.
for instance in worker-01 worker-02 worker-03
do
ssh -t k8s@${instance} sudo systemctl enable systemd-resolved.service
ssh -t k8s@${instance} sudo systemctl start systemd-resolved.service
done
Deploy the coredns
cluster add-on:
kubectl apply -f https://raw.githubusercontent.com/ansilh/kubernetes-the-hardway-virtualbox/master/config/coredns.yaml
output
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
List the pods created by the kube-dns
deployment:
kubectl get pods -l k8s-app=kube-dns -n kube-system
output
NAME READY STATUS RESTARTS AGE
coredns-699f8ddd77-5bszs 1/1 Running 0 11m
coredns-699f8ddd77-bz2jd 1/1 Running 0 11m
Create a run-once dnstool
Pod:
kubectl run -it --rm --restart=Never --image=infoblox/dnstools:latest dnstools
- From temonal execute nslookup
dnstools# time nslookup kubernetes
Server: 172.168.0.2
Address: 172.168.0.2#53
Name: kubernetes.default.svc.cluster.local
Address: 172.168.0.1
real 0m 0.00s
user 0m 0.00s
sys 0m 0.00s
- Exit from terminal (Pod will be removed automatically after exit.!)
Part 13 - Bare Metal Load Balancer Configuration