Kubernetes advices on local virtualized cluster

Update nameservers used by CoreDNS for internet resolution (Ubuntu)

Last time I used vbox for my cluster, internet resolution was blocked by my company because not using the appropriate resolvers.

I learnt that CoreDNS can be tuned easily by modifying its configmap (ready /etc/resolv.conf by default) but wanted to understand why it was not working properly anyway.

On Ubuntu, first, I looked at my resolv.conf but that was useless : nameserver 127.0.0.53
Then I found culprit dns servers on netplan :

      nameservers:
        addresses: [4.2.2.1, 4.2.2.2, 208.67.220.220]

But it wasn’t enough.
Finally i realized that servers were also specified on /etc/systemd/resolved.conf

[Resolve]
DNS=4.2.2.1 4.2.2.2 208.67.220.220

I updated them, restarted the systemd-resolved service and deleted the CoreDNS pods to recreate them and reload the config.

Update Kubelet to use the good ip on a node with multiple NIC

  1. Add “–node-ip” to ‘/var/lib/kubelet/kubeadm-flags.env’:
[root@Node-18121 ~]# cat /var/lib/kubelet/kubeadm-flags.env
KUBELET_KUBEADM_ARGS=--cgroup-driver=systemd --network-plugin=cni --pod-infra-container-image=k8s.gcr.io/pause:3.1 --node-ip=192.168.X.Y
  1. Restart Kubelet:
systemctl daemon-reload && systemctl restart kubelet