Skip to content

Instantly share code, notes, and snippets.

@boffbowsh
Created March 19, 2017 16:52
Show Gist options
  • Save boffbowsh/246547a821b2b8b255784d986b38edc4 to your computer and use it in GitHub Desktop.
Save boffbowsh/246547a821b2b8b255784d986b38edc4 to your computer and use it in GitHub Desktop.
A vagrantfile for starting a master + 2 node kubernetes cluster
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provision "shell", inline: <<-SHELL
apt-get update && apt-get dist-upgrade -y && apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
echo 'deb http://apt.kubernetes.io/ kubernetes-xenial main' > /etc/apt/sources.list.d/kubernetes.list
apt-get update
apt-get install -y docker.io kubelet kubeadm kubectl kubernetes-cni
usermod -aG docker ubuntu
SHELL
config.vm.provider "virtualbox" do |v|
v.linked_clone = true
v.memory = 1024
v.cpus = 2
end
config.ssh.username = "ubuntu"
config.vm.define "m1" do |vm|
vm.vm.network "public_network", ip: "192.168.1.80", nic_type: "virtio"
vm.vm.hostname = "master"
end
config.vm.define "w1" do |vm|
vm.vm.network "public_network", ip: "192.168.1.81", nic_type: "virtio"
vm.vm.hostname = "worker1"
end
config.vm.define "w2" do |vm|
vm.vm.network "public_network", ip: "192.168.1.82", nic_type: "virtio"
vm.vm.hostname = "worker2"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment