Getting error while deploying k8 cluster

Hi ,
I am trying to deploy cluster referring the “kubernetes-the-hard-way” repo.
I am trying to setup on a Linux VM with virtualbox and vagrant installed.

While running Vagrant script getting following error and the script failing to deploy vm’s on virtualbox.

$ vagrant up
Bringing machine 'controlplane01' up with 'virtualbox' provider...
Bringing machine 'controlplane02' up with 'virtualbox' provider...
Bringing machine 'loadbalancer' up with 'virtualbox' provider...
Bringing machine 'node01' up with 'virtualbox' provider...
Bringing machine 'node02' up with 'virtualbox' provider...
==> controlplane01: Importing base box 'ubuntu/jammy64'...
==> controlplane01: Matching MAC address for NAT networking...
==> controlplane01: Setting the name of the VM: kubernetes-ha-controlplane-1
==> controlplane01: Clearing any previously set network interfaces...
==> controlplane01: Preparing network interfaces based on configuration...
    controlplane01: Adapter 1: nat
    controlplane01: Adapter 2: hostonly
==> controlplane01: Forwarding ports...
    controlplane01: 22 (guest) => 2711 (host) (adapter 1)
    controlplane01: 22 (guest) => 2222 (host) (adapter 1)
==> controlplane01: Running 'pre-boot' VM customizations...
==> controlplane01: Booting VM...
==> controlplane01: Waiting for machine to boot. This may take a few minutes...
    controlplane01: SSH address: 127.0.0.1:2222
    controlplane01: SSH username: vagrant
    **controlplane01: SSH auth method: private key**
**    controlplane01: Warning: Connection reset. Retrying...**
**    controlplane01: Warning: Connection reset. Retrying...**
**    controlplane01: Warning: Connection reset. Retrying...**
**    controlplane01:** 
    controlplane01: Vagrant insecure key detected. Vagrant will automatically replace
    controlplane01: this with a newly generated keypair for better security.
    controlplane01: 
    controlplane01: Inserting generated public key within guest...
    controlplane01: Removing insecure key from the guest if it's present...
    controlplane01: Key inserted! Disconnecting and reconnecting using new SSH key...
==> controlplane01: Machine booted and ready!
==> controlplane01: Checking for guest additions in VM...
    controlplane01: The guest additions on this VM do not match the installed version of
    controlplane01: VirtualBox! In most cases this is fine, but in rare cases it can
    controlplane01: prevent things such as shared folders from working properly. If you see
    controlplane01: shared folder errors, please make sure the guest additions within the
    controlplane01: virtual machine match the version of VirtualBox you have installed on
    controlplane01: your host and reload your VM.
    controlplane01: 
    controlplane01: Guest Additions Version: 6.0.0 r127566
    controlplane01: VirtualBox Version: 6.1
==> controlplane01: Setting hostname...
==> controlplane01: Configuring and enabling network interfaces...
==> controlplane01: Mounting shared folders...
    controlplane01: /vagrant => /home/yp/kubernetes-the-hard-way/vagrant
==> controlplane01: Running provisioner: setup-kernel (shell)...
    controlplane01: Running: /tmp/vagrant-shell20241013-1918331-st8te8.sh
    controlplane01: * Applying /etc/sysctl.d/10-console-messages.conf ...
    controlplane01: kernel.printk = 4 4 1 7
    controlplane01: * Applying /etc/sysctl.d/10-ipv6-privacy.conf ...
    controlplane01: net.ipv6.conf.all.use_tempaddr = 2
    controlplane01: net.ipv6.conf.default.use_tempaddr = 2
    controlplane01: * Applying /etc/sysctl.d/10-kernel-hardening.conf ...
    controlplane01: kernel.kptr_restrict = 1
    controlplane01: * Applying /etc/sysctl.d/10-kubernetes.conf ...
    controlplane01: net.ipv6.conf.all.disable_ipv6 = 1
    controlplane01: net.ipv6.conf.default.disable_ipv6 = 1
    controlplane01: net.ipv6.conf.lo.disable_ipv6 = 1
    controlplane01: net.bridge.bridge-nf-call-iptables = 1
    controlplane01: net.ipv4.ip_forward = 1
    controlplane01: * Applying /etc/sysctl.d/10-magic-sysrq.conf ...
    controlplane01: kernel.sysrq = 176
    controlplane01: * Applying /etc/sysctl.d/10-network-security.conf ...
    controlplane01: net.ipv4.conf.default.rp_filter = 2
    controlplane01: net.ipv4.conf.all.rp_filter = 2
    controlplane01: * Applying /etc/sysctl.d/10-ptrace.conf ...
    controlplane01: kernel.yama.ptrace_scope = 1
    controlplane01: * Applying /etc/sysctl.d/10-zeropage.conf ...
    controlplane01: vm.mmap_min_addr = 65536
    controlplane01: * Applying /usr/lib/sysctl.d/50-default.conf ...
    controlplane01: kernel.core_uses_pid = 1
    controlplane01: net.ipv4.conf.default.rp_filter = 2
    controlplane01: net.ipv4.conf.default.accept_source_route = 0
    **controlplane01: sysctl: setting key "net.ipv4.conf.all.accept_source_route": Invalid argument**
    controlplane01: net.ipv4.conf.default.promote_secondaries = 1
    **controlplane01: sysctl: setting key "net.ipv4.conf.all.promote_secondaries": Invalid argument**
    controlplane01: net.ipv4.ping_group_range = 0 2147483647
    controlplane01: net.core.default_qdisc = fq_codel
    controlplane01: fs.protected_hardlinks = 1
    controlplane01: fs.protected_symlinks = 1
    controlplane01: fs.protected_regular = 1
    controlplane01: fs.protected_fifos = 1
    controlplane01: * Applying /usr/lib/sysctl.d/50-pid-max.conf ...
    controlplane01: kernel.pid_max = 4194304
    controlplane01: * Applying /etc/sysctl.d/99-cloudimg-ipv6.conf ...
    controlplane01: net.ipv6.conf.all.use_tempaddr = 0
    controlplane01: net.ipv6.conf.default.use_tempaddr = 0
    controlplane01: * Applying /usr/lib/sysctl.d/99-protect-links.conf ...
    controlplane01: fs.protected_fifos = 1
    controlplane01: fs.protected_hardlinks = 1
    controlplane01: fs.protected_regular = 2
    controlplane01: fs.protected_symlinks = 1
    controlplane01: * Applying /etc/sysctl.d/99-sysctl.conf ...
    controlplane01: * Applying /etc/sysctl.conf ...
==> controlplane01: Running provisioner: setup-ssh (shell)...
    controlplane01: Running: /tmp/vagrant-shell20241013-1918331-hd8byl.sh
**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.**

Could somone help to identify what is causing the issue.

Thanks

The exact errored lines are

controlplane01: sysctl: setting key “net.ipv4.conf.all.accept_source_route”: Invalid argument
controlplane01: sysctl: setting key “net.ipv4.conf.all.promote_secondaries”: Invalid argument
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.

That’s a very old copy of Virtualbox. Have you tried a more up-to-date copy of it?

Hi,
Yes i am using the latest version 7.1.2 of Virtualbox.

Thanks

HI,

Can anyone share here the recent working setup of Vagrant and Virtualbox software versions.

You may need to fall back to 7.0; the problem right now is that Vagrant does not yet support 7.1 as of October 2024. See Vagrant’s Virtualbox page for info.