1. 程式人生 > >怎樣使用Vagrant在幾分鐘裡搭建出一套多節點的虛機測試環境

怎樣使用Vagrant在幾分鐘裡搭建出一套多節點的虛機測試環境

D:\soft\k8s-vagrant-demo>vagrant upBringing machine 'kube-node1' up with 'virtualbox' provider...Bringing machine 'kube-node2' up with 'virtualbox' provider...Bringing machine 'kube-node3' up with 'virtualbox' provider...Bringing machine 'kube-server' up with 'virtualbox' provider...==> kube-node1: Clearing any previously set network interfaces...==> kube-node1: Preparing network interfaces based on configuration...    kube-node1: Adapter 1: nat    kube-node1: Adapter 2: hostonly==> kube-node1: Forwarding ports...    kube-node1: 22 (guest) => 2222 (host) (adapter 1)==> kube-node1: Running 'pre-boot' VM customizations...==> kube-node1: Booting VM...==> kube-node1: Waiting for machine to boot. This may take a few minutes...    kube-node1: SSH address: 127.0.0.1:2222    kube-node1: SSH username: vagrant    kube-node1: SSH auth method: private key    kube-node1: Warning: Connection reset. Retrying...    kube-node1: Warning: Connection aborted. Retrying...    kube-node1: Warning: Connection reset. Retrying...    kube-node1:    kube-node1: Vagrant insecure key detected. Vagrant will automatically replace    kube-node1: this with a newly generated keypair for better security.    kube-node1:    kube-node1: Inserting generated public key within guest...    kube-node1: Removing insecure key from the guest if it's present...    kube-node1: Key inserted! Disconnecting and reconnecting using new SSH key...==> kube-node1: Machine booted and ready!==> kube-node1: Checking for guest additions in VM...==> kube-node1: Setting hostname...==> kube-node1: Configuring and enabling network interfaces...    kube-node1: SSH address: 127.0.0.1:2222    kube-node1: SSH username: vagrant    kube-node1: SSH auth method: private key==> kube-node1: Mounting shared folders...    kube-node1: /vagrant => D:/soft/k8s-vagrant-demo==> kube-node2: Importing base box 'boxes/centos-7.5'...==> kube-node2: Matching MAC address for NAT networking...==> kube-node2: Setting the name of the VM: kube-node2==> kube-node2: Fixed port collision for 22 => 2222. Now on port 2200.==> kube-node2: Clearing any previously set network interfaces...==> kube-node2: Preparing network interfaces based on configuration...    kube-node2: Adapter 1: nat    kube-node2: Adapter 2: hostonly==> kube-node2: Forwarding ports...    kube-node2: 22 (guest) => 2200 (host) (adapter 1)==> kube-node2: Running 'pre-boot' VM customizations...==> kube-node2: Booting VM...==> kube-node2: Waiting for machine to boot. This may take a few minutes...    kube-node2: SSH address: 127.0.0.1:2200    kube-node2: SSH username: vagrant    kube-node2: SSH auth method: private key    kube-node2: Warning: Connection aborted. Retrying...    kube-node2: Warning: Connection aborted. Retrying...    kube-node2: Warning: Connection reset. Retrying...    kube-node2: Warning: Remote connection disconnect. Retrying...    kube-node2: Warning: Connection aborted. Retrying...    kube-node2: Warning: Connection reset. Retrying...    kube-node2:    kube-node2: Vagrant insecure key detected. Vagrant will automatically replace    kube-node2: this with a newly generated keypair for better security.    kube-node2:    kube-node2: Inserting generated public key within guest...    kube-node2: Removing insecure key from the guest if it's present...    kube-node2: Key inserted! Disconnecting and reconnecting using new SSH key...==> kube-node2: Machine booted and ready!==> kube-node2: Checking for guest additions in VM...==> kube-node2: Setting hostname...==> kube-node2: Configuring and enabling network interfaces...    kube-node2: SSH address: 127.0.0.1:2200    kube-node2: SSH username: vagrant    kube-node2: SSH auth method: private key==> kube-node2: Mounting shared folders...    kube-node2: /vagrant => D:/soft/k8s-vagrant-demo==> kube-node3: Importing base box 'boxes/centos-7.5'...==> kube-node3: Matching MAC address for NAT networking...==> kube-node3: Setting the name of the VM: kube-node3==> kube-node3: Fixed port collision for 22 => 2222. Now on port 2201.==> kube-node3: Clearing any previously set network interfaces...==> kube-node3: Preparing network interfaces based on configuration...    kube-node3: Adapter 1: nat    kube-node3: Adapter 2: hostonly==> kube-node3: Forwarding ports...    kube-node3: 22 (guest) => 2201 (host) (adapter 1)==> kube-node3: Running 'pre-boot' VM customizations...==> kube-node3: Booting VM...==> kube-node3: Waiting for machine to boot. This may take a few minutes...    kube-node3: SSH address: 127.0.0.1:2201    kube-node3: SSH username: vagrant    kube-node3: SSH auth method: private key    kube-node3: Warning: Remote connection disconnect. Retrying...    kube-node3: Warning: Connection aborted. Retrying...    kube-node3: Warning: Connection reset. Retrying...    kube-node3: Warning: Remote connection disconnect. Retrying...    kube-node3: Warning: Connection aborted. Retrying...    kube-node3: Warning: Remote connection disconnect. Retrying...    kube-node3: Warning: Connection aborted. Retrying...    kube-node3:    kube-node3: Vagrant insecure key detected. Vagrant will automatically replace    kube-node3: this with a newly generated keypair for better security.    kube-node3:    kube-node3: Inserting generated public key within guest...    kube-node3: Removing insecure key from the guest if it's present...    kube-node3: Key inserted! Disconnecting and reconnecting using new SSH key...==> kube-node3: Machine booted and ready!==> kube-node3: Checking for guest additions in VM...==> kube-node3: Setting hostname...==> kube-node3: Configuring and enabling network interfaces...    kube-node3: SSH address: 127.0.0.1:2201    kube-node3: SSH username: vagrant    kube-node3: SSH auth method: private key==> kube-node3: Mounting shared folders...    kube-node3: /vagrant => D:/soft/k8s-vagrant-demo==> kube-server: Clearing any previously set forwarded ports...==> kube-server: Fixed port collision for 22 => 2222. Now on port 2202.==> kube-server: Clearing any previously set network interfaces...==> kube-server: Preparing network interfaces based on configuration...    kube-server: Adapter 1: nat    kube-server: Adapter 2: hostonly==> kube-server: Forwarding ports...    kube-server: 8080 (guest) => 8080 (host) (adapter 1)    kube-server: 8086 (guest) => 8086 (host) (adapter 1)    kube-server: 443 (guest) => 4443 (host) (adapter 1)    kube-server: 22 (guest) => 2202 (host) (adapter 1)==> kube-server: Running 'pre-boot' VM customizations...==> kube-server: Booting VM...==> kube-server: Waiting for machine to boot. This may take a few minutes...    kube-server: SSH address: 127.0.0.1:2202    kube-server: SSH username: vagrant    kube-server: SSH auth method: private key    kube-server: Warning: Connection reset. Retrying...    kube-server: Warning: Connection aborted. Retrying...==> kube-server: Machine booted and ready!==> kube-server: Checking for guest additions in VM...==> kube-server: Setting hostname...==> kube-server: Configuring and enabling network interfaces...    kube-server: SSH address: 127.0.0.1:2202    kube-server: SSH username: vagrant    kube-server: SSH auth method: private key==> kube-server: Mounting shared folders...    kube-server: /vagrant => D:/soft/k8s-vagrant-demo==> kube-server: Machine already provisioned. Run `vagrant provision` or use the`--provision`==> kube-server: flag to force provisioning. Provisioners marked to run always will still run.D:\soft\k8s-vagrant-demo>