Installing MicroK8s with multipass

Multipass is the fastest way to create a complete Ubuntu virtual machine on Linux, Windows or macOS, and it’s a great base for using MicroK8s.

For snap-capable operating systems, it can be installed with a single command:

sudo snap install multipass

Note: For other platforms, please check out the latest install guides on the Multipass website

With multipass installed, you can now create a VM to run MicroK8s. At least 4
Gigabytes of RAM and 40G of storage is recommended – we can pass these
requirements when we launch the VM:

multipass launch --name microk8s-vm --mem 4G --disk 40G

We can now find the IP address which has been allocated. Running:

multipass list

… will return something like:

Name                    State             IPv4             Release
microk8s-vm             RUNNING           10.72.145.216    Ubuntu 18.04 LTS

Take a note of this IP as services will become available there when accessed
from the host machine.

To work within the VM environment more easily, you can run a shell:

multipass shell microk8s-vm

Then install the MicroK8s snap and configure the network:

sudo snap install microk8s --classic --channel=1.18/stable
sudo iptables -P FORWARD ACCEPT

The iptables command is necessary to permit traffic between the VM and host.

From within the VM shell, you can now follow along the rest of the
quick start instructions

Useful multipass commands

  • Get a shell inside the VM:

    multipass shell microk8s-vm
    
  • Shutdown the VM:

    multipass stop microk8s-vm
    
  • Delete and cleanup the VM:

    multipass delete microk8s-vm
    multipass purge
    

Last updated a month ago. Help improve this document in the forum.