I’m a novice in k8s and I’m facing an issue while creating my cluster with kubeadm. Indeed I’ve created my control plane on my ubuntu 22.04 VM and installed flannel as CNI plugin, and I would like to create a worker node on the same VM. So I ran this command line on my control plane :
sudo kubeadm join 172.18.0.1:6443 --token fy2xvc.532gauuiuotbz03f --discovery-token-ca-cert-hash sha256:52c16ad7535414592820b7da2d8f2621e19ad0e0e9f2cfd82797dd853a29925e --cri-socket unix:///var/run/cri-dockerd.sock
This is the output :
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR FileAvailable--etc-kubernetes-kubelet.conf]: /etc/kubernetes/kubelet.conf already exists
[ERROR Port-10250]: Port 10250 is in use
[ERROR FileAvailable--etc-kubernetes-pki-ca.crt]: /etc/kubernetes/pki/ca.crt already exists
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher
So my question is can we create and roll out a master and worker node on the same VM (aka node) ? If so, how can fix this issue and create my worker node ?
Any help would be much appreciated.
Regards
YT
2
Answers
I don't need no more help since I found that it's technically not possible to roll out a cluster compound of separate master and worker nodes on one VM with Kubeadm.
Nevertheless, thanks for helping me!
Regards
YT
Yes you can have master nodes and workers nodes on the same machine, you just need to make sure you have/allocate enough RAM and CPU cores to each of these nodes. Different requirements exist, depending on the compute loads.
In the error you pasted, it seems that you executed the
kubeadm init
command and that the master and worker nodes didn’t join. However, it created thekubelet.conf
as well as theca.crt
. It is a known issue.It is recommended that you run the
--ignore-preflight-errors='DirAvailable--etc-kubernetes-manifests,FileAvailable--etc-kubernetes-kubelet.conf,Port-10250,FileAvailable--etc-kubernetes-pki-ca.crt'
as arguments of thekubeadm join
command.As seen here.
About the port 10250 in use, you can kill what is running on it (the kubelet most likely) using the
netstat -ltnp | grep -w ":10250"
command.