Open survivant opened 3 years ago
here my virtual swtich vagrant
if I change the config for
config.vm.define "2worker1" do |worker|
worker.vm.provider "hyperv" do |p|
p.ip_address_timeout = 60
p.memory = 2048
p.cpus = 2
p.mac = "00155D62F44B"
p.vmname = "2k8s-worker1"
end
worker.vm.network "private_network", ip: "192.168.50.181"
worker.vm.hostname = "2k8s-worker1"
end
I'll obtain this for the worker2
==> 2worker1: Verifying Hyper-V is enabled...
==> 2worker1: Verifying Hyper-V is accessible...
==> 2worker1: Importing a Hyper-V instance
2worker1: Creating and registering the VM...
2worker1: Successfully imported VM
2worker1: Please choose a switch to attach to your Hyper-V instance.
2worker1: If none of these are appropriate, please open the Hyper-V manager
2worker1: to create a new virtual switch.
2worker1:
2worker1: 1) vagrant
2worker1: 2) Default Switch
2worker1: 3) WSL
2worker1:
2worker1: What switch would you like to use? 2
2worker1: Configuring the VM...
2worker1: Setting VM Enhanced session transport type to disabled/default (VMBus)
==> 2worker1: [Settings] [Network Adapter] Setting MAC address to: 00155D62F44B
==> 2worker1: Starting the machine... ==> 2worker1: Waiting for the machine to report its IP address... 2worker1: Timeout: 60 seconds 2worker1: IP: 172.25.152.108 ==> 2worker1: Waiting for machine to boot. This may take a few minutes... 2worker1: SSH address: 172.25.152.108:22 2worker1: SSH username: vagrant 2worker1: SSH auth method: private key 2worker1: 2worker1: Vagrant insecure key detected. Vagrant will automatically replace 2worker1: this with a newly generated keypair for better security.
2worker1:
2worker1: Inserting generated public key within guest...
2worker1: Removing insecure key from the guest if it's present...
2worker1: Key inserted! Disconnecting and reconnecting using new SSH key...
==> 2worker1: Machine booted and ready!
==> 2worker1: Preparing SMB shared folders...
Vagrant requires administrator access to create SMB shares and
may request access to complete setup of configured shares.
==> 2worker1: Setting hostname...
==> 2worker1: Mounting SMB shared folders...
2worker1: F:/junk/05 => /vagrant
but the IP if not the right one
I can do that to and vagrant will find the IP and mount the SMB share
config.vm.define "2worker2" do |worker|
worker.vm.provider "hyperv" do |p|
p.ip_address_timeout = 60
p.memory = 2048
p.cpus = 2
p.mac = "00155D62F44F"
p.vmname = "2k8s-worker2"
end
worker.vm.network "private_network", ip: "192.168.50.182", bridge: 'Default Switch'
worker.vm.hostname = "2k8s-worker2"
end
I found that I can create the VM with "Default Switch" and after change the switch to "vagrant" and reboot. The VM will works but the SMB share folder is not mount anymore.
there is a workaround for the SMB. I can use add a line in /etc/fstab to mount it followed by sudo mount -a
Hyper-V networking is still pretty much non-existent vagrantup.com/docs/providers/hyperv/limitations, you can only really get a dynamic IP from DHCP.
A result of this is that networking configurations in the Vagrantfile are completely ignored with Hyper-V. Vagrant cannot enforce a static IP or automatically configure a NAT
I've tried to get some more discussion going here on this discussion ticket from 2017 because I've been wanting the same thing and got a PoC going https://github.com/hashicorp/vagrant/issues/8384
PS. I try with vagrant 2.1.15 and I have the same result.
PS. I change the timeout value to 10 minutes to 10 sec.. it doesn't change the result :(
I'm able to connect to the VM and retreive the IP (it's the same as in the vagrantfile)
I can run vagrant up 3 times.. and all my VM will be created at the end.. but I'm not sure which steps will be missing.