Kubernetes trouble - /var/lib/calico/nodename: no such file or directory

Solution 1:

Got it. In my setup I've got two VirtualBox VMs both with two network interfaces - one to connect with outer world (10.0.2.15) and one to talk to each other (192.168.56.104, 192.168.56.105). In kubeadm init log I've found that it was using first one, so I've explicitly told kubeadm to use internal IP. Here is command with which I've succeeded to create cluster and deploy simple app into it

kubeadm init --apiserver-advertise-address=192.168.56.104 --apiserver-cert-extra-sans=192.168.56.104 --node-name k8smaster --pod-network-cidr=192.168.0.0/24 --kubernetes-version=1.19.1

One sad thing - unfortunately I could not find how to add to config options which I've used in command line.

Solution 2:

Thank you so much Dmitriy. This Definitely saves my day. I'm also working on setting up the cluster using virtualbox for the LFD course and encountered the same error. The calico pod is not running on the worker node and the error message is the same.

I would highly recommend to use a different network than 192.168 as the ip address of the VMs on virtualbox. It's pretty simeple. All you need to do is to create a new host network in virtualbox and add that network as a network adapter to your VMs. I created a 172.16.16.0/24 network for both of my VMs and therefore I don't need to update any config. All I need to do was to update the kubeadm init cmd and put the corrent ip address there.