Install Local Kubernetes on Ubuntu 20.04

Kubernetes - K8s

Installation

Install Docker Ubuntu

Refer: https://linuxconfig.org/how-to-install-docker-on-ubuntu-20-04-lts-focal-fossa

Use the apt command to install the docker.io package

sudo apt install docker.io

Start docker and enable it to start after the system reboot

sudo systemctl enable --now docker

Optionally give any user administrative privileges to docker

sudo usermod -aG docker SOMEUSERNAME

Reboot Computer to Verify

reboot

Check docker version

docker --version

Verify Installation

docker run hello-world

Install Single node with MicroKs

Refer: https://ubuntu.com/kubernetes/install#single-node

Install latest MicroK8s

sudo snap install microk8s --classic

Optionally give any user administrative privileges to microk8s

sudo usermod -a -G microk8s mruckman
sudo chown -f -R mruckman ~/.kube

After installing MicroK8s, you should verify it is ready. Use this command, after another reboot:

microk8s.status

To block until MicroK8s is ready, use the following command:

microk8s.status --wait-ready

Accessing Kubernetes: MicroK8s embeds a kubectl and a .kubeconfig file required for accessing the installed MicroK8s. This avoids colliding with any local versions that might be already installed. Here is an example of how to use this:

microk8s.kubectl

Leave a Reply