How to Install MicroK8s: A Beginner's Guide
How to Install MicroK8s: A Beginner’s Guide
MicroK8s is a lightweight Kubernetes deployment built by Canonical, the makers of Ubuntu. Ideal for local development and testing, MicroK8s makes it easy to create a Kubernetes cluster on a single machine. This guide will walk you through the setup process.
Prerequisites
- An Ubuntu 18.04 or later environment
- Administrative rights on the system
- A stable internet connection
Step 1: Install MicroK8s
Open the terminal and execute the following command:
sudo snap install microk8s --classic
This command installs MicroK8s along with the necessary dependencies.
Step 2: Setting Permissions
To allow your user to run commands without using sudo, add it to the ‘microk8s’ group:
sudo usermod -a -G microk8s $USER
newgrp microk8s
Once added, verify your membership with:
groups
Step 3: Enabling Addons
MicroK8s comes with a set of powerful addons for cloud-native application development. You can enable an addon with:
microk8s enable dashboard dns
This enables the Kubernetes dashboard and DNS service, necessary for most Kubernetes operations.
Step 4: Verifying Installation
Check the status of your MicroK8s installation using:
microk8s status --wait-ready
This command verifies that all services are operational.
Step 5: Accessing Kubernetes
You can start using kubectl by aliasing it:
alias kubectl='microk8s kubectl'
Test the setup by fetching available nodes:
kubectl get nodes
Troubleshooting
If you encounter issues, verify the status of MicroK8s services with:
microk8s inspect
This command offers insights and solutions for common problems.
Summary Checklist
- Snap install MicroK8s
- Add user to MicroK8s group
- Enable necessary addons
- Verify installation status
- Configure kubectl alias
With MicroK8s up and running, you can explore more about Kubernetes deployments on your local setup. For more advanced setups, see our guide on installing Kube-hunter for Security Testing in Kubernetes.
