This post provides context for justinwalz/microk8s-vagrant.

At work, we use AWS EKS to manage our Kubernetes clusters. So when it came time to deploy my hobby project, I couldn’t imagine going back to anything else.

Yes. I think Kubernetes is that convenient. Furthermore, it's easier cognitively to use a similar enough stack at work and home.

To be clear, in the ddpast, I’ve used a wide spectrum of methods. I've done the dead simple SSH + clone + run. I've wrapped it that in ansible. I've transitioned by ansible scripts to build and run docker containers. At work, we've used Nomad to schedule our containers. Now using Kubernetes I feel that I cannot go back to any other way. Queue dramatic music... well... I mean, I could. Sometimes it makes sense to do something else. Yada yada yada. But for now, Kubernetes is the way.

However, looking at EKS, the cost was about $75 a month just for the control plane. Too much for a hobby setup.

So I looked at kops. Then kubeadm. Both of which I’ve used at work. Both seemed like overkill.

Then I saw microk8s. Boom. It looked lovely, and promising. Built by canonical, they advertise running Kubernetes on a Raspberry Pi? Alright, it can definitely run on my t3 instance.

So here we are. Setting up microk8s for my personal account.

Before we rack up any cloud charges though, let’s use Vagrant to test this out. My laptop runs Manjaro (happily, thanks to the influence of my coworkers), so this provides a pain free way to get a clean, repeatable, and destroyable Ubuntu install.

Is this guide out of date? Does something require an extra hint? Let me know by replying to this tweet. Furthermore, errors and omissions are my own. I followed this guide for a local microk8s deployment.

MicroK8s is a small, fast, single-package Kubernetes for developers, IoT and edge. github

Vagrant

Let's keep it simple. I assume familiarity with Vagrant. However, in a nutshell it will provision an Ubuntu VM for us to use.

Save this as Vagrantfile.

# <https://app.vagrantup.com/bento/boxes/ubuntu-20.04>
Vagrant.configure("2") do |config|
  config.vm.box = "bento/ubuntu-20.04"
end

Create, login, update.

vagrant up
vagrant ssh
sudo apt update && sudo apt upgrade

Provisioning

We can view available channels with snap info microk8s. At the time of writing, k8s 1.21 is the most recent. Let's use that.