Installing MicroK8s Offline or in an airgapped environment

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).

If you are installing on a non-Ubuntu OS, you will also need to download the core snap, in a similar way:

snap download core

this will retrieve an additional two files to the local directory:

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

Transfer the files to the target, offline machine.

In the case of non-Ubuntu OSes, install the core snap first:

   snap ack core_9993.assert
   snap install core_9993.snap

(substitute the actual names of the files you downloaded)

For all OSes, MicroK8s can then be installed with the following commands:

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

Note that 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 5 months ago. Help improve this document in the forum.