mmumshad / kubernetes-the-hard-way

Bootstrap Kubernetes the hard way on Vagrant on Local Machine. No scripts.
Apache License 2.0
4.6k stars 4.48k forks source link

The Load Balancer VM enters panic mode while being provisioned by vagrant #300

Closed MarkKharitonov closed 6 months ago

MarkKharitonov commented 1 year ago

master-1 and master-2 are provisioned, even though I had to run the vagrant.exe up command more than once (because of config.vm.boot_timeout seemingly being too small).

However, vagrant is unable to create the Load Balancer VM:

C:\work\kubernetes-the-hard-way\vagrant [master ≡]> vagrant.exe up
Bringing machine 'master-1' up with 'virtualbox' provider...
Bringing machine 'master-2' up with 'virtualbox' provider...
Bringing machine 'loadbalancer' up with 'virtualbox' provider...
Bringing machine 'worker-1' up with 'virtualbox' provider...
Bringing machine 'worker-2' up with 'virtualbox' provider...
==> master-1: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> master-1: flag to force provisioning. Provisioners marked to run always will still run.
==> master-2: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> master-2: flag to force provisioning. Provisioners marked to run always will still run.
==> loadbalancer: Importing base box 'ubuntu/jammy64'...
==> loadbalancer: Matching MAC address for NAT networking...
==> loadbalancer: Setting the name of the VM: kubernetes-ha-lb
==> loadbalancer: Fixed port collision for 22 => 2222. Now on port 2201.
==> loadbalancer: Clearing any previously set network interfaces...
==> loadbalancer: Preparing network interfaces based on configuration...
    loadbalancer: Adapter 1: nat
    loadbalancer: Adapter 2: hostonly
==> loadbalancer: Forwarding ports...
    loadbalancer: 22 (guest) => 2730 (host) (adapter 1)
    loadbalancer: 22 (guest) => 2201 (host) (adapter 1)
==> loadbalancer: Running 'pre-boot' VM customizations...
==> loadbalancer: Booting VM...
==> loadbalancer: Waiting for machine to boot. This may take a few minutes...
    loadbalancer: SSH address: 127.0.0.1:2201
    loadbalancer: SSH username: vagrant
    loadbalancer: SSH auth method: private key
The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'paused' state. Please verify everything is configured
properly and try again.

If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.

The primary issue for this error is that the provider you're using
is not properly configured. This is very rarely a Vagrant issue.
C:\work\kubernetes-the-hard-way\vagrant [master ≡]>

The VM output is: image

Which is very disturbing. The VirtualBox logs (from %UserProfile%\VirtualBox VMs\kubernetes-ha-lb\Logs) are attached. Logs.zip

Please, advise. Thank you.

vomba commented 1 year ago

I have the same issue here, any help ?

MarkKharitonov commented 1 year ago

This was driving me crazy. I could increase the count of master machines to 4 and they are created fine. But when it tried to create the load balancer or the workers (if I switch the order) then it failed with the kernel panic. Finally it dawned upon me - the number of CPUs! For some reason VirtualBox just refuses to create a VM with one CPU.

So after I bumped the CPU count to 2 all the VMs were created. Maybe it has to do with the hyper-threading - if a hyper-thread counts to one CPU, then it is impossible to have just one CPU on a VM.

vomba commented 1 year ago

Can confirm bumping the CPU count to 2 did the job.

My setup win11 16Go RAM i710750H