Kubernetes DNS config on bare metal
One of the ‘newer’ functions of Kubernetes is the ability to register service names in DNS. More specifically, to register them in a DNS server running in the Kubernetes cluster. To do this, the clever folks at Google came up with a solution that leverages SkyDNS and another container (called kube2sky) to read the service entries and insert them as DNS entries. Pretty slick huh?
Beyond the containers to run the DNS service, we also need to tell the pods to use this particular DNS server for DNS resolution. This is done by adding a couple of lines of config to the kubernetes-kubelet service. Once that’s done, we can configure the Kubernetes service and the replication controller for the SkyDNS pod. So let’s start with the kubelet service configuration. Let’s edit our service definition located here…
/usr/lib/systemd/system/kubernetes-kubelet.service
Our new config will look like this…
[Unit] Description=Kubernetes Kubelet After=etcd.service After=docker.service Wants=etcd.service Wants=docker.service [Service] ExecStart=/opt/kubernetes/kubelet --address=10.20.30.62 --port=10250 --hostname_override=10.20.30.62 --etcd_servers=http://10.20.30.61:4001 --logtostderr=true --cluster_dns=10.100.0.10 --cluster_domain=kubdomain.local Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target
Notice that Continue reading