[caasp-beta] How-To: Setting Up an internal DNS

Alejandro Bonilla abonilla at suse.com
Wed Apr 12 10:27:32 MDT 2017


Hi Beta Testers -

(Before you proceed, please refer to my previous e-mail, "A few How-To guides coming your way”)

—

In order for containers to resolve each other, a DNS needs to be in-place. There are many ways to implement this, but let’s start with what perhaps is the simplest.

1. If your network is like mine (which I think the SUSE CaaSP Beta 2 deploys on the same subnet) - the API may be running on

	default svc/kubernetes 172.21.0.1 <none> 443/TCP 11d

2. I have then selected 172.21.0.2 as the internal DNS address

3. Save the attached dns-addon.yaml (review it if you want to see what it’s doing) and run

	kubectl create -f dns-addon.yaml

4. SSH into ALL your WORKER NODES and open the kubelet config file

	vi /etc/kubernetes/kubelet

5. Modify 'KUEBELET_ARGS=' and add '--cluster-dns 172.21.0.2 --cluster-domain=cluster.local’  - mine looks like

# Add your own!
KUBELET_ARGS="\
--node-ip=192.168.122.66 --cluster-dns 172.21.0.2 --cluster-domain=cluster.local \
   --config=/etc/kubernetes/manifests \
--pod-infra-container-image=sles12/pause:1.0.0 \
\
   --kubeconfig=/var/lib/kubelet/kubeconfig”

6. Restart kubelet (on all workers)

	rckubelet restart

7. Any new deployment will use the new dns-server for internal resolution (and Forward the rest). Test it:

	kubectl run -i -t busybox --image=busybox --restart=Never 

Waiting for pod default/busybox to be running, status is Pending, pod ready: false 
Waiting for pod default/busybox to be running, status is Pending, pod ready: false 
If you don't see a command prompt, try pressing enter. 

	/ # cat /etc/resolv.conf 

search default.svc.cluster.local svc.cluster.local cluster.local 
nameserver 172.21.0.2 
options ndots:5 

	/ # nslookup 172.21.0.1 

Server: 172.21.0.2 
Address 1: 172.21.0.2 kube-dns.kube-system.svc.cluster.local 

Name: 172.21.0.1 A
ddress 1: 172.21.0.1 kubernetes.default.svc.cluster.local	

	/ # ping google.com

PING google.com (172.217.5.238): 56 data bytes
64 bytes from 172.217.5.238: seq=0 ttl=54 time=12.060 m

	exit
	kubectl delete pod busybox


Please let me know if something went wrong… or right…

Thanks,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: dns-addon.yaml
Type: application/octet-stream
Size: 3157 bytes
Desc: dns-addon.yaml
URL: <http://lists.suse.com/pipermail/caasp-beta/attachments/20170412/cdff86a9/attachment.dll>


More information about the caasp-beta mailing list