I have the following project that I use to create my own Kubernetes cluster on the local machine (macOS) via KubeAdm: https://github.com/sasadangelo/k8s-cluster Basically, I started from this project and did the following update:
- Configure the Vagrant deployment via a YAML file.
- Support the K8s 1.6 APIs, K8s 1.18, and Calico 3.8.8
- Automatic K8s dashboard deploy.
Now I am fine with this cluster but I have some DNS issues I would like to understand how to solve. The tool uses a Vagrant file to start 3 Vagrant boxes then I use mainly 3 scripts:
- configure_box.sh, I use to install on each box the required software like docker, kubeadm, kubelet, kubectl, etc.
- configure_master.sh, used to configure only the master node, install network plugin, and run the
kubeadm init
. - configure_worker.sh, used to configure the worker node joining the cluster.
My problem is that resolv.conf
of my Pods looks like this:
nameserver 10.96.0.10
search default.svc.cluster.local svc.cluster.local cluster.local <other domain coming from host machine>
options ndots:5
This file has two problems:
- doesn't allow me to access the Internet. In fact, I have to add manually add it adding this line at the beginning of the file:
nameserver 8.8.8.8
and remove it when not required anymore (if I keep it internal DNS doesn't work)
- in the search clause there are domains coming from my host machines:
<other domain coming from host machine>
that cause issues.
I read a lot of documentation but I still have problems figuring out how to change my code to avoid these two problems.