-
Notifications
You must be signed in to change notification settings - Fork 2
/
Vagrantfile_macOS_withWi-Fi_bridge
93 lines (86 loc) · 3.64 KB
/
Vagrantfile_macOS_withWi-Fi_bridge
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# -*- mode: ruby -*-
# vi: set ft=ruby :
ENV['VAGRANT_NO_PARALLEL'] = 'yes'
Vagrant.configure(2) do |config|
#
#Install vagrant-scp and vagrant-vbguest plugins
config.vagrant.plugins = ["vagrant-scp", "vagrant-vbguest"]
# Common provisioning code for all VMs
# IP address of your LAN's router e.g. 192.168.0.1
default_router = "192.168.0.1"
# change/ensure the default route via the local network's WAN router, useful for public_network/bridged mode
config.vm.provision :shell, run: "always", :inline => "ip route delete default >/dev/null 2>&1 || true; ip route add default via #{default_router} >/dev/null 2>&1"
# config.vm.provision "shell", path: "step_1_bootstrap.sh"
config.vm.provision "shell", path: "step_1_bootstrap.sh"
DNS_Name = "lk8s.net"
# Initial Kubernetes Master Servers
MasterCount = 3
# 3 Kubernetes Masters
(1..MasterCount).each do |m|
config.vm.define "kmaster#{m}" do |kmaster|
kmaster.vm.box = "kub-base-centos77"
kmaster.vm.synced_folder ".", "/vagrant", type: "virtualbox"
kmaster.vm.hostname = "kmaster#{m}.#{DNS_Name}"
kmaster.vm.network "public_network", ip: "192.168.0.2#{m}", bridge: "en0: Wi-Fi (Wireless)"
kmaster.vm.network "private_network", ip: "10.10.10.2#{m}",
virtualbox__intnet: true
kmaster.vm.provider "virtualbox" do |v|
v.name = "kmaster#{m}"
v.memory = 2048
v.cpus = 2
v.customize ["modifyvm", :id, "--hwvirtex", "on"]
v.customize ["modifyvm", :id, "--nested-hw-virt","on"]
v.customize ["modifyvm", :id, "--cpuhotplug","on"]
v.customize ["modifyvm", :id, "--audio", "none"]
v.customize ["modifyvm", :id, "--nictype1", "virtio"]
v.customize ["modifyvm", :id, "--nictype2", "virtio"]
v.customize ["modifyvm", :id, "--nictype3", "virtio"]
end
end
end
NodeCount = 3
# Add 3 Kubernetes Worker Nodes
(1..NodeCount).each do |i|
config.vm.define "node#{i}" do |workernode|
workernode.vm.box = "kub-base-centos77"
workernode.vm.synced_folder ".", "/vagrant", type: "virtualbox"
workernode.vm.hostname = "node#{i}.#{DNS_Name}"
workernode.vm.network "public_network", ip: "192.168.0.4#{i}", bridge: "en0: Wi-Fi (Wireless)"
workernode.vm.network "private_network", ip: "10.10.10.4#{i}",
virtualbox__intnet: true
workernode.vm.provider "virtualbox" do |v|
v.name = "node#{i}"
v.memory = 4096
v.cpus = 4
v.customize ["modifyvm", :id, "--hwvirtex", "on"]
v.customize ["modifyvm", :id, "--nested-hw-virt","on"]
v.customize ["modifyvm", :id, "--cpuhotplug","on"]
v.customize ["modifyvm", :id, "--audio", "none"]
v.customize ["modifyvm", :id, "--nictype1", "virtio"]
v.customize ["modifyvm", :id, "--nictype2", "virtio"]
v.customize ["modifyvm", :id, "--nictype3", "virtio"]
end
end
end
# Nginx LB Node
config.vm.define "lb" do |lb|
lb.vm.box = "kub-base-centos77"
lb.vm.synced_folder ".", "/vagrant", type: "virtualbox"
lb.vm.hostname = "lb.#{DNS_Name}"
lb.vm.network "public_network", ip: "192.168.0.10", bridge: "en0: Wi-Fi (Wireless)"
lb.vm.network "private_network", ip: "10.10.10.10",
virtualbox__intnet: true
lb.vm.provider "virtualbox" do |v|
v.name = "lb.lk8s.net"
v.memory = 1048
v.cpus = 1
v.customize ["modifyvm", :id, "--hwvirtex", "on"]
v.customize ["modifyvm", :id, "--nested-hw-virt","on"]
v.customize ["modifyvm", :id, "--cpuhotplug","on"]
v.customize ["modifyvm", :id, "--audio", "none"]
v.customize ["modifyvm", :id, "--nictype1", "virtio"]
v.customize ["modifyvm", :id, "--nictype2", "virtio"]
v.customize ["modifyvm", :id, "--nictype3", "virtio"]
end
end
end