Hello,
I switch my configuration from an old computer with Ubuntu 20.04 / Virtualbox 6 / Vagrant 2.3.7 to a new one with Ubuntu 22.04 / Virtualbox 7 / Vagrant 2.3.7. The configuration worked correctly on my old computer.
Here is my config:
IMAGE_NAME = "debian/bullseye64"
MASTERS = 1
NODES = 2
Vagrant.configure("2") do |config|
config.ssh.insert_key = false
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 1
end
(1..MASTERS).each do |i|
config.vm.define "master-#{i}" do |master|
master.vm.box = IMAGE_NAME
master.vm.network "private_network", ip: "192.168.56.#{i + 100}"
master.vm.hostname = "k8s-master-#{i}"
# naming the virtualmachine
master.vm.provider :virtualbox do |vb|
vb.name = "k8s-master-#{i}"
end
master.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "/tmp/id_rsa.pub"
# change ansible to ansible_local if you are running from windows,
# so that vagrant will install ansible inside VM and run ansible playbooks
# eg: master.vm.provision "ansible_local" do |ansible|
master.vm.provision "ansible_local" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "node-config.yml"
end
end
end
(1..NODES).each do |i|
config.vm.define "node-#{i}" do |node|
node.vm.box = IMAGE_NAME
node.vm.network "private_network", ip: "192.168.56.#{i + 110}"
node.vm.hostname = "k8s-node-#{i}"
# naming the virtualmachine
node.vm.provider :virtualbox do |vb|
vb.name = "k8s-node-#{i}"
end
node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "/tmp/id_rsa.pub"
# change ansible to ansible_local if you are running from windows,
# so that vagrant will install ansible inside VM and run ansible playbooks
# eg: node.vm.provision "ansible_local" do |ansible|
node.vm.provision "ansible_local" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "node-config.yml"
end
end
end
end
When I do a vagrant up, I have the error message below:
Bringing machine 'master-1' up with 'virtualbox' provider...
Bringing machine 'node-1' up with 'virtualbox' provider...
Bringing machine 'node-2' up with 'virtualbox' provider...
==> master-1: Checking if box 'debian/bullseye64' version '11.20230615.1' is up to date...
==> master-1: Clearing any previously set forwarded ports...
==> master-1: Fixed port collision for 22 => 2222. Now on port 2202.
==> master-1: Clearing any previously set network interfaces...
==> master-1: Preparing network interfaces based on configuration...
master-1: Adapter 1: nat
master-1: Adapter 2: hostonly
==> master-1: Forwarding ports...
master-1: 22 (guest) => 2202 (host) (adapter 1)
==> master-1: Running 'pre-boot' VM customizations...
==> master-1: Booting VM...
==> master-1: Waiting for machine to boot. This may take a few minutes...
The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'poweroff' 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.
However when I go to virtualbox gui and I start the vm, the vm is starting correctly so I don’t understand what’s wrong … is-it a bug ?
Thanks.