I am setting up a Kubernetes cluster using Ubuntu 18.04 virtual machines with Vagrant. All goes well until I try to run the kubeadm join 10.0.2.15:6443 --token ...
command on a worker node, and I get the error:
[preflight] Running pre-flight checks
error execution phase preflight: couldn't validate the identity of the API Server: Get "https://10.0.2.15:6443/api/v1/namespaces/kube-public/configmaps/cluster-info?timeout=10s": dial tcp 10.0.2.15:6443: connect: connection refused
My hypothesis is that this is a networking issue, because the IP address that was specified by the kubeadm token create --print-join-command
in the Control Plane node was 10.0.2.15:6443
, which is not the IP address I had specified for the Control Plan node in the Vagrantfile (172.16.94.10
, see below). However, even when I change the kubeadm join command manually like so: sudo kubeadm join 172.16.94.10:6443 --token ...
, I get a similar error. How can I resolve this?
Ubuntu system info:
System load: 0.22 Users logged in: 0
Usage of /: 4.4% of 97.23GB IP address for eth0: 10.0.2.15
Memory usage: 40% IP address for eth1: 172.16.94.10
Swap usage: 0% IP address for tunl0: 192.168.13.192
Processes: 144
Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "base"
config.vm.define "c1-cp1" do |c1cp1|
c1cp1.vm.box = "bento/ubuntu-18.04"
c1cp1.disksize.size = '100GB'
c1cp1.vm.network "private_network", ip: "172.16.94.10"
c1cp1.vm.hostname = "c1-cp1"
c1cp1.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
vb.cpus = "2"
end
end
config.vm.define "c1-node1" do |c1node1|
c1node1.vm.box = "bento/ubuntu-18.04"
c1node1.disksize.size = '100GB'
c1node1.vm.network "private_network", ip: "172.16.94.11"
c1node1.vm.hostname = "c1-node1"
c1node1.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
vb.cpus = "2"
end
end
end