Alternative installs (MacOS/Windows 10/Multipass)

MicroK8s is spectacularly easy to install and use on Ubuntu or any Linux which
supports snaps. For other platforms or less common scenarios, see the relevant
notes below.

Windows 10

Note: We recommend Windows 10 Professional or Windows 10 Enterprise. MicroK8s will also require at least 4GB of available RAM and 40GB of storage.

  1. Download the MicroK8s Installer
    Download the latest installer here

  2. Run the installer
    installer image
    The installer checks if Hyper-V is available and switched on. If you don’t have Hyper-v (e.g. on Windows 10 Home edition) it is possible to use VirtualBox as an alternative.

  3. Configure MicroK8s
    configure image
    You can now configure MicroK8s - the minimum recommendations are already provided.
    For information on changing the ‘Snap Track’, see this page.
    You can change this configuration at a later date by re-running the installer. Note that the Memory and Disk limits are initially set at the minimum values. If you are planning on running large workloads (e.g. kubeflow will require around 12GB RAM) you will want to set these higher.

  4. Open a command line
    command line image

  5. Check the status while Kubernetes starts
    microk8s status --wait-ready

  6. Turn on the services you want
    MicroK8s includes a series of add-ons and services which can be enabled at any time. For example:
    microk8s enable dashboard dns registry istio
    Try running microk8s enable --help for a list of built-in services.
    Turn off services with the microk8s disable command.

  7. Start using Kubernetes!
    MicroK8s wraps the kubectl command familiar to Kubernetes users, so you can simply perform any usual Kubernetes operation. Try:
    microk8s kubectl get all --all-namespaces

  8. Access the Kubernetes dashboard
    microk8s dashboard-proxy

  9. Start and stop Kubernetes
    Kubernetes is a collection of system services that talk to each other all the time. If you don’t need them running in the background then you will save battery and resources by stopping them. microk8s start and microk8s stop will do the work for you.

What next?

macOS

Note: Installing MicroK8s with Multipass requires macOS Yosemite, version 10.10.3 or later installed on hardware from 2010 onwards. It will also require at least 4GB of available RAM and 40GB of storage.

The installer for MicroK8s uses HomeBrew. If you don’t have the brew command you can install it from the Homebrew website.

  1. Download the MicroK8s installer
    brew install ubuntu/microk8s/microk8s

  2. Run the installer
    microk8s install

  3. Check the status while Kubernetes starts
    microk8s status --wait-ready

  4. Turn on the services you want
    microk8s enable dashboard dns registry istio
    Try microk8s enable --help for a list of available services built in. The microk8s disable command turns off a service.

  5. Start using Kubernetes!
    microk8s kubectl get all --all-namespaces

  6. Access the Kubernetes dashboard
    microk8s dashboard-proxy

  7. Start and stop Kubernetes
    Kubernetes is a collection of system services that talk to each other all the time. If you don’t need them running in the background then you will save battery/resources by stopping them. the microk8s start and microk8s stop commands will do the work for you.

Multipass

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

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
    

Raspberry Pi/ARM

Running MicroK8s on some ARM hardware may run into difficulties because cgroups
(required!) are not enabled by default. This can be remedied on the Rasberry Pi
by editing the boot parameters:

sudo vi /boot/firmware/cmdline.txt

Note: In some Raspberry Pi Linux distributions the boot parameters are in `/boot/firmware/nobtcmd.txt`.

And adding the following:

cgroup_enable=memory cgroup_memory=1

Systems using ZFS

There is currently an issue surrounding using MicroK8s on a ZFS filesystem due
to the way containerd is configured. If you have installed MicroK8s on ZFS
you can fix this:

  1. Stop microk8s:

    microk8s stop
    
  2. Remove old state of containerd:

    sudo rm -rf /var/snap/microk8s/common/var/lib/containerd
    
  3. Configure containerd to use ZFS:
    Edit the file /var/snap/microk8s/current/args/containerd-template.toml
    replacing snapshotter = "overlayfs" with snapshotter = "zfs"

  4. Create new zfs dataset for containerd to use:

    zfs create -o mountpoint=/var/snap/microk8s/common/var/lib/containerd/io.containerd.snapshotter.v1.zfs $POOL/containerd
    
  5. Restart microk8s:

    microk8s start
    

Offline deployments

There are situations where it is necessary or desirable to run MicroK8s on a
machine not connected to the internet. This is possible, but there are a few
extra things to be aware of.

Downloading a snap

If the machine you are intending to install MicroK8s to has no connectivity at
all, it is possible to download the snap from a machine which does have
access to the internet.

snap download microk8s

this will retrieve two files to the local directory:

  • microk8s_xxx.snap: The snap package with a versioned suffix.
  • microk8s_xxx.assert: The assertion file (effectively a signature validating the package).

When the files are transferred to the offline machine, MicroK8s can then be
installed with the following commands:

sudo snap ack microk8s_993.assert
sudo snap install microk8s_993.snap

In an offline environment, the snap will not be able to contact the store for
any updates.

Simulating a network

In some environments, as well as being offline, there is no network capability
at all (e.g. no NIC hardware). In such cases the Kubernetes apiserver will not
be able to work. This can be solved by simulating hardware (e.g. in a VM) or
adding a virtual address.

For an example, see this answer on askubuntu.

Setting up proxies

While the above method works fine for MicroK8s itself, in a true offline environment additional difficulties will be encountered when enabling various add-ons. The content of the add-ons themselves are fetched when they are first enabled. E.g. the istio add-on fetches a tarball from github, the kubeflow addon fetches resources from the Juju charm store. To enable MicroK8s to work offline with add-ons, the services required by the individual add-ons will need to be proxied locally. Setting up individual proxies is beyond the scope of this documentation. For Ubuntu systems, you may find the Server documentation useful.


Last updated 25 days ago.