Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Vagrant Ubuntu 18.04 + Docker + k3d Setting up
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# = "hashicorp/bionic64"
config.vm.box_check_update = true
# Forwarded port mapping: 8052 -> 8502 for exposed service "forwarded_port", guest: 8502, host: 8502
# Forwarded port mapping: 8052 -> 8502 for kubernetes dasboard "forwarded_port", guest: 8503, host: 8503
# Create a private network, which allows host-only access to the machine
# using a specific IP. "private_network", ip: ""
# Share an additional folder to the guest VM
config.vm.synced_folder "./shared", "/vagrant_data"
# Customize the disk size on the guest VM: (using vagrant-disksize plugin)
config.disksize.size = '50GB'
# Customize hostname of the guestVM
config.vm.hostname = "k3d-cluster"
config.vm.provider "virtualbox" do |vb|
# Customize the amount of memory on the guest VM:
vb.memory = "2048"
# Enable provisioning guest VM with shell script
config.vm.provision "shell", inline: <<-SHELL
apt-get update -y
# Install Docker
# Reference:
apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL | apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"
apt-get update -y
apt-get install -y docker-ce docker-ce-cli
# Install k3d
# Reference:
wget -q -O - | bash
# Install kubectl
curl -LO "$(curl -s"
mv kubectl /usr/local/bin/
chmod +x /usr/local/bin/kubectl
# Add vagrant user to docker group (Running docker command without sudo)
addgroup -a vagrant docker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment