-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVagrantfile
89 lines (69 loc) · 3.43 KB
/
Vagrantfile
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
IP_MASTER1 = "192.168.101.101"
IP_WORKER1 = "192.168.101.201"
IP_WORKER2 = "192.168.101.202"
POD_NW_CIDR = "10.244.0.0/16"
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.box_check_update = false
config.vm.define "cluster1-master1" do |node|
node.vm.provider "virtualbox" do |vb|
vb.name = "cluster1-master1"
vb.memory = 2048
vb.cpus = 2
vb.customize [
"modifyvm", :id, "--uartmode1", "file",
File.join(Dir.pwd, "tmp/cluster1-master1.log")
]
end
node.vm.hostname = "cluster1-master1"
node.vm.network :private_network, ip: IP_MASTER1
node.vm.provision "set-hosts", :type => "shell", :path => "scripts/set-hosts.sh" do |s|
s.args = ["enp0s8"]
end
node.vm.provision 'shell', inline: "cat /vagrant/certs/id_rsa.pub >> /root/.ssh/authorized_keys"
node.vm.provision "update-dns", type: "shell", :path => "scripts/update-dns.sh"
node.vm.provision "install-kube", type: "shell", :path => "scripts/install-kube.sh", env: {"NODE_IP" => "#{IP_MASTER1}"}
node.vm.provision "install-master", type: "shell", :path => "scripts/install-master.sh", env: {"MASTER_IP" => "#{IP_MASTER1}", "POD_NW_CIDR" => "#{POD_NW_CIDR}"}
node.vm.provision "configure-master1", type: "shell", :path => "scripts/configure-master1.sh"
end
config.vm.define "cluster1-worker1" do |node|
node.vm.provider "virtualbox" do |vb|
vb.name = "cluster1-worker1"
vb.memory = 2048
vb.cpus = 1
vb.customize [
"modifyvm", :id, "--uartmode1", "file",
File.join(Dir.pwd, "tmp/cluster1-worker1.log")
]
end
node.vm.hostname = "cluster1-worker1"
node.vm.network :private_network, ip: IP_WORKER1
node.vm.provision "set-hosts", :type => "shell", :path => "scripts/set-hosts.sh" do |s|
s.args = ["enp0s8"]
end
node.vm.provision 'shell', inline: "cat /vagrant/certs/id_rsa.pub >> /root/.ssh/authorized_keys"
node.vm.provision "update-dns", type: "shell", :path => "scripts/update-dns.sh"
node.vm.provision "install-kube", type: "shell", :path => "scripts/install-kube.sh", env: {"NODE_IP" => "#{IP_WORKER1}"}
node.vm.provision "install-worker", type: "shell", :path => "scripts/install-worker.sh", env: {"MASTER_IP" => "#{IP_MASTER1}"}
end
config.vm.define "cluster1-worker2" do |node|
node.vm.provider "virtualbox" do |vb|
vb.name = "cluster1-worker2"
vb.memory = 2048
vb.cpus = 1
vb.customize [
"modifyvm", :id, "--uartmode1", "file",
File.join(Dir.pwd, "tmp/cluster1-worker2.log")
]
end
node.vm.hostname = "cluster1-worker2"
node.vm.network :private_network, ip: IP_WORKER2
node.vm.provision "set-hosts", :type => "shell", :path => "scripts/set-hosts.sh" do |s|
s.args = ["enp0s8"]
end
node.vm.provision 'shell', inline: "cat /vagrant/certs/id_rsa.pub >> /root/.ssh/authorized_keys"
node.vm.provision "update-dns", type: "shell", :path => "scripts/update-dns.sh"
node.vm.provision "install-kube", type: "shell", :path => "scripts/install-kube.sh", env: {"NODE_IP" => "#{IP_WORKER2}"}
node.vm.provision "install-worker", type: "shell", :path => "scripts/install-worker.sh", env: {"MASTER_IP" => "#{IP_MASTER1}"}
end
end