Install MicroK8s offline (deprecated)
This document details the procedure to install MicroK8s on an offline machine.
Prerequisites
Please ensure that the installation of MicroK8s is performed on a machine that meets the technical requirements.
Get required files
Connect via SSH on a machine with the same operating system as the machine where Cyberwatch will be deployed. This machine must be connected to the internet.
Create the
sources
directory:mkdir microk8s_sources; cd microk8s_sources
Download the packages:
On a Red Hat based distribution:
Install
yum-utils
:sudo yum install yum-utils curl epel-release
Download
snapd
and its dependencies:sudo yumdownloader --resolve snapd
Install
snapd
:sudo yum install snapd
Install
podman
:sudo yum install podman export CONTAINER_DOWNLOADER=podman
On a Debian-based distribution:
Download dependencies of package
snapd
:This command downloads the whole dependency tree to ensure that the installation will work on the offline machine.
apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests \ --no-conflicts --no-breaks --no-replaces --no-enhances \ --no-pre-depends snapd | grep "^\w")
Install
snapd
sudo apt install snapd
Install
docker
:sudo apt install docker.io export CONTAINER_DOWNLOADER=docker
Download the container images required by MicroK8s:
sudo $CONTAINER_DOWNLOADER pull docker.io/calico/cni:v3.13.2 sudo $CONTAINER_DOWNLOADER pull docker.io/calico/pod2daemon-flexvol:v3.13.2 sudo $CONTAINER_DOWNLOADER pull docker.io/calico/kube-controllers:v3.13.2 sudo $CONTAINER_DOWNLOADER pull docker.io/calico/node:v3.13.2 sudo $CONTAINER_DOWNLOADER pull docker.io/coredns/coredns:1.6.6 sudo $CONTAINER_DOWNLOADER pull k8s.gcr.io/pause:3.1 sudo $CONTAINER_DOWNLOADER save docker.io/calico/cni:v3.13.2 -o cni.tar sudo $CONTAINER_DOWNLOADER save docker.io/calico/pod2daemon-flexvol:v3.13.2 -o pod2daemon.tar sudo $CONTAINER_DOWNLOADER save docker.io/calico/kube-controllers:v3.13.2 -o kube-controllers.tar sudo $CONTAINER_DOWNLOADER save docker.io/calico/node:v3.13.2 -o node.tar sudo $CONTAINER_DOWNLOADER save docker.io/coredns/coredns:1.6.6 -o coredns.tar sudo $CONTAINER_DOWNLOADER save k8s.gcr.io/pause:3.1 -o pause.tar
Download snap packages for
microk8s
andhelm
:sudo snap download core sudo snap download microk8s --channel=1.20/stable sudo snap download core18 sudo snap download helm --channel=3.5/stable
Archive all the files:
cd .. sudo tar czvf microk8s_sources.tar.gz microk8s_sources
Install MicroK8s
Transfer the archive on the offline machine.
Switch to the
root
user:sudo su
Extract the sources:
tar xvzf microk8s_sources.tar.gz cd microk8s_sources
Install
snapd
:On a Red Hat based distribution:
yum install *.rpm
On a Debian-based distribution:
dpkg -i *.deb
Enable and start snapd and snap’s classic mode:
systemctl enable snapd --now ln -s /var/lib/snapd/snap /snap
Install
microk8s
andhelm
:ls *.assert | xargs -n 1 snap ack ls *.snap | xargs -n 1 snap install --classic
Start MicroK8s:
/snap/bin/microk8s start
Load the images into MicroK8s:
ls *.tar| xargs -n 1 -I {} /snap/bin/microk8s ctr i import $(pwd)/{}