forked from tomdee/kube-cluster
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Vagrantfile
72 lines (58 loc) · 2.3 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
# Size of the cluster created by Vagrant
num_instances=3
# Change basename of the VM
instance_name_prefix="k8s"
# Official CoreOS channel from which updates should be downloaded
update_channel='stable'
Vagrant.configure("2") do |config|
# always use Vagrants insecure key
config.ssh.insert_key = false
config.vm.box = "coreos-%s" % update_channel
config.vm.box_url = "http://%s.release.core-os.net/amd64-usr/current/coreos_production_vagrant.json" % update_channel
config.vm.provider :virtualbox do |v|
# On VirtualBox, we don't have guest additions or a functional vboxsf
# in CoreOS, so tell Vagrant that so it can be smarter.
v.check_guest_additions = false
v.memory = 2048
v.cpus = 2
v.functional_vboxsf = false
end
# Set up each box
(1..num_instances).each do |i|
# Determine the VM's name.
if i == 1
vm_name = "%s-%s" % [instance_name_prefix, "master"]
else
vm_name = "%s-node-%02d" % [instance_name_prefix, i-1]
end
config.vm.define vm_name do |host|
host.vm.hostname = vm_name
ip = "172.18.18.#{i+100}"
host.vm.network :private_network, ip: ip
# Use a different cloud-init on the first server.
if i == 1
config.vm.provider :virtualbox do |v|
v.memory = 2048
v.cpus = 2
end
# Pre-fetch docker images.
host.vm.provision :docker, images: ["calico/node:v0.18.0"]
# Install the demos folder.
host.vm.provision :file, :source => "demos", :destination => "/home/core/demos"
# Install cloud-config.
host.vm.provision :file, :source => "cloud-config/master-config-template.yaml", :destination => "/tmp/vagrantfile-user-data"
host.vm.provision :shell, :inline => "mv /tmp/vagrantfile-user-data /var/lib/coreos-vagrant/", :privileged => true
else
config.vm.provider :virtualbox do |v|
v.memory = 2048
v.cpus = 2
end
# Pre-fetch Docker images.
host.vm.provision :docker, images: ["calico/node:v0.18.0", "gcr.io/google_containers/pause:latest"]
# Install cloud-config.
host.vm.provision :file, :source => "cloud-config/node-config-template.yaml", :destination => "/tmp/vagrantfile-user-data"
host.vm.provision :shell, :inline => "mv /tmp/vagrantfile-user-data /var/lib/coreos-vagrant/", :privileged => true
end
end
end
end