forked from caseydavenport/kube-cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
69 lines (56 loc) · 2.18 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
# Size of the cluster created by Vagrant
num_instances=4
# 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 = 1024
v.cpus = 2
end
# Pre-fetch docker images.
host.vm.provision :docker, images: ["calico/node:v0.17.0-k8s-policy"]
# Install cloud-config.
host.vm.provision :file, :source => "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 = 1
end
# Pre-fetch Docker images.
host.vm.provision :docker, images: ["calico/node:v0.17.0-k8s-policy", "gcr.io/google_containers/pause:latest"]
# Install cloud-config.
host.vm.provision :file, :source => "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