2.6. Installing MicroK8s

MicroK8s is a lightweight Kubernetes environment. (Kubernetes is a system for managing and deploying containerized applications like the LOCKSS system.) This page will walk you through the initial installation of MicroK8s.

The LOCKSS system requires MicroK8s 1.18.

All the commands on this page should be run as the lockss user.

2.6.1. Installing MicroK8s

To install the MicroK8s Snap package, run this Snap command:

sudo snap install microk8s --classic --channel=1.18/stable

2.6.1.1. Troubleshooting

In some flavors of Linux (including Debian 9), sometimes the above command fails. Try running the following command first:

sudo snap install core

then retry installing the MicroK8s Snap package.

2.6.2. Joining the microk8s Group

MicroK8s creates a group to enable usage of commands which require admin privilege. To add your current user to the group and gain access to the .kube caching directory, run the following two commands:

sudo usermod -G microk8s -a lockss

2.6.3. Logging Out and Back In

Log out and back in again (or restart your system) for the group update to take place.

After you log back in as lockss, try:

microk8s --help

to check that MicroK8s is on your PATH. You should see a help message similar to the following:

Available subcommands are:
     add-node
     cilium
     config
...

If you see an error message instead (such as bash: microk8s: command not found), you need to ensure /snap/bin is on the PATH.

2.6.4. Generating the Kubernetes Configuration

Generate the Kubernetes configuration file from MicroK8s using these commands:

mkdir -p ~/.kube

sudo chown -f -R lockss ~/.kube

microk8s config --use-loopback > ~/.kube/config

2.6.5. Starting MicroK8s

Type the following command which will start MicroK8s and wait until it is fully ready.

microk8s status --wait-ready

It will then display the status of various MicroK8s subsystems:

microk8s is running
addons:
dashboard: disabled
dns: disabled
...

REFERENCES

Additional Documentation

MicroK8s References

Kubectl References