vagrant provisioning
Closed this issue · 1 comments
Describe the bug
Failed mid-way on installing the 2 nodes. I attempted to ssh into the vagrant kmaster, copied /joincluster.sh, ssh back to kworker1 and ran it as root and I got:
[preflight] Running pre-flight checks
error execution phase preflight: couldn't validate the identity of the API Server: Get "https://192.168.56.100:6443/api/v1/namespaces/kube-public/configmaps/cluster-info?timeout=10s": dial tcp 192.168.56.100:6443: connect: protocol not available
How To Reproduce
pull master branch.
cd kubernetes/vagrant-provisioning/
vagrant up
Expected behavior
Should be set up with a master and a worker node
Screenshots (if any)
vagrant up
Bringing machine 'kmaster' up with 'virtualbox' provider...
Bringing machine 'kworker1' up with 'virtualbox' provider...
Bringing machine 'kworker2' up with 'virtualbox' provider...
==> kmaster: Importing base box 'generic/ubuntu2204'...
==> kmaster: Matching MAC address for NAT networking...
==> kmaster: Setting the name of the VM: kmaster
==> kmaster: Clearing any previously set network interfaces...
==> kmaster: Preparing network interfaces based on configuration...
kmaster: Adapter 1: nat
kmaster: Adapter 2: hostonly
==> kmaster: Forwarding ports...
kmaster: 22 (guest) => 2222 (host) (adapter 1)
==> kmaster: Running 'pre-boot' VM customizations...
==> kmaster: Booting VM...
==> kmaster: Waiting for machine to boot. This may take a few minutes...
kmaster: SSH address: 127.0.0.1:2222
kmaster: SSH username: vagrant
kmaster: SSH auth method: private key
kmaster:
kmaster: Vagrant insecure key detected. Vagrant will automatically replace
kmaster: this with a newly generated keypair for better security.
kmaster:
kmaster: Inserting generated public key within guest...
kmaster: Removing insecure key from the guest if it's present...
kmaster: Key inserted! Disconnecting and reconnecting using new SSH key...
==> kmaster: Machine booted and ready!
==> kmaster: Checking for guest additions in VM...
kmaster: The guest additions on this VM do not match the installed version of
kmaster: VirtualBox! In most cases this is fine, but in rare cases it can
kmaster: prevent things such as shared folders from working properly. If you see
kmaster: shared folder errors, please make sure the guest additions within the
kmaster: virtual machine match the version of VirtualBox you have installed on
kmaster: your host and reload your VM.
kmaster:
kmaster: Guest Additions Version: 6.1.38
kmaster: VirtualBox Version: 7.0
==> kmaster: Setting hostname...
==> kmaster: Configuring and enabling network interfaces...
==> kmaster: Running provisioner: shell...
kmaster: Running: /tmp/vagrant-shell20240125-286192-4ilcc3.sh
kmaster: [TASK 1] Disable and turn off SWAP
kmaster: [TASK 2] Stop and Disable firewall
kmaster: [TASK 3] Enable and Load Kernel modules
kmaster: [TASK 4] Add Kernel settings
kmaster: [TASK 5] Install containerd runtime
kmaster: [TASK 6] Set up kubernetes repo
kmaster: [TASK 7] Install Kubernetes components (kubeadm, kubelet and kubectl)
kmaster: [TASK 8] Enable ssh password authentication
kmaster: [TASK 9] Set root password
kmaster: [TASK 10] Update /etc/hosts file
==> kmaster: Running provisioner: shell...
kmaster: Running: /tmp/vagrant-shell20240125-286192-e6hrio.sh
kmaster: [TASK 1] Pull required containers
kmaster: [TASK 2] Initialize Kubernetes Cluster
kmaster: [TASK 3] Deploy Calico network
kmaster: [TASK 4] Generate and save cluster join command to /joincluster.sh
==> kworker1: Importing base box 'generic/ubuntu2204'...
==> kworker1: Matching MAC address for NAT networking...
==> kworker1: Setting the name of the VM: kworker1
==> kworker1: Fixed port collision for 22 => 2222. Now on port 2200.
==> kworker1: Clearing any previously set network interfaces...
==> kworker1: Preparing network interfaces based on configuration...
kworker1: Adapter 1: nat
kworker1: Adapter 2: hostonly
==> kworker1: Forwarding ports...
kworker1: 22 (guest) => 2200 (host) (adapter 1)
==> kworker1: Running 'pre-boot' VM customizations...
==> kworker1: Booting VM...
==> kworker1: Waiting for machine to boot. This may take a few minutes...
kworker1: SSH address: 127.0.0.1:2200
kworker1: SSH username: vagrant
kworker1: SSH auth method: private key
kworker1:
kworker1: Vagrant insecure key detected. Vagrant will automatically replace
kworker1: this with a newly generated keypair for better security.
kworker1:
kworker1: Inserting generated public key within guest...
kworker1: Removing insecure key from the guest if it's present...
kworker1: Key inserted! Disconnecting and reconnecting using new SSH key...
==> kworker1: Machine booted and ready!
==> kworker1: Checking for guest additions in VM...
kworker1: The guest additions on this VM do not match the installed version of
kworker1: VirtualBox! In most cases this is fine, but in rare cases it can
kworker1: prevent things such as shared folders from working properly. If you see
kworker1: shared folder errors, please make sure the guest additions within the
kworker1: virtual machine match the version of VirtualBox you have installed on
kworker1: your host and reload your VM.
kworker1:
kworker1: Guest Additions Version: 6.1.38
kworker1: VirtualBox Version: 7.0
==> kworker1: Setting hostname...
==> kworker1: Configuring and enabling network interfaces...
==> kworker1: Running provisioner: shell...
kworker1: Running: /tmp/vagrant-shell20240125-286192-gtaquk.sh
kworker1: [TASK 1] Disable and turn off SWAP
kworker1: [TASK 2] Stop and Disable firewall
kworker1: [TASK 3] Enable and Load Kernel modules
kworker1: [TASK 4] Add Kernel settings
kworker1: [TASK 5] Install containerd runtime
kworker1: [TASK 6] Set up kubernetes repo
kworker1: [TASK 7] Install Kubernetes components (kubeadm, kubelet and kubectl)
kworker1: [TASK 8] Enable ssh password authentication
kworker1: [TASK 9] Set root password
kworker1: [TASK 10] Update /etc/hosts file
==> kworker1: Running provisioner: shell...
kworker1: Running: /tmp/vagrant-shell20240125-286192-ez87rb.sh
kworker1: [TASK 1] Join node to Kubernetes Cluster
kworker1: bash: /joincluster.sh: No such file or directory
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
Environment (please complete the following information):
uname -a
Linux archlinux 6.7.1-arch1-1 # 1 SMP PREEMPT_DYNAMIC Sun, 21 Jan 2024 22:14:10 +0000 x86_64 GNU/Linux
nproc
32 core
free -h
total used free shared buff/cache available
Mem: 62Gi 24Gi 13Gi 1.1Gi 26Gi 38Gi
Swap: 4.0Gi 4.0Mi 4.0Gi
Additional Context
I also need to change the IPs so it match my private IP ranges:
The IP address configured for the host-only network is not within the
allowed ranges. Please update the address used to be within the allowed
ranges and run the command again.
Address: 172.16.16.100
Ranges: 192.168.56.0/21
Something like this:
cat >>/etc/hosts<<EOF
192.168.56.100 kmaster.example.com kmaster
192.168.56.101 kworker1.example.com kworker1
192.168.56.102 kworker2.example.com kworker2
EOF
@liketoeatcheese thanks for reporting your issue.
I would like to keep the script as generic as possible. People can extend these scripts to their needs. The ip address range change is specific to your usecase. Feel free to change it in vagrantfile and elsewhere.
Remove all stderr redirections in the bootstrap scripts to see more details about error.