What are the steps to configure a MicroK8s Kubernetes Cluster on Ubuntu?
Kubernetes clusters provide a dependable and scalable environment for hosting containerized applications. Designed with DevOps in consideration, Kubernetes simplifies maintenance tasks like upgrades.
MicroK8s is a certified upstream Kubernetes deployment from the CNCF that operates fully on your workstation or edge device. As a snap package, it natively runs all Kubernetes services without relying on virtual machines, including all necessary libraries and binaries. Installation speed is only constrained by your download capabilities of a few hundred megabytes, and uninstalling MicroK8s ensures no residual files are left behind.
Step 1: Log in to your Cloud account dashboard and access your Ubuntu server via SSH.
Step 2: Run the following command to ensure your system is up-to-date:
sudo apt update && sudo apt upgrade -y
Step 3: Installing Microk8s
The first thing you’ll do is install Microk8s on each node. So log in to your first node and issue the command:
sudo snap install microk8s --classic
Step 4: Verify MicroK8s Installation
After installation, check if MicroK8s is running with:
microk8s status --wait-ready
This will display the status of the MicroK8s cluster. It should show “microk8s is running” after it is initialized.
Step 5: Enable Required Add-ons
MicroK8s provides several useful add-ons. To enable common add-ons like the DNS service, the dashboard, and storage, run:
microk8s enable dns dashboard storage
Other add-ons that can be enabled include metrics-server, ingress, prometheus, etc.
Step 6: Check Cluster Status
After enabling the add-ons, you can check the status of the Kubernetes components:
microk8s kubectl get nodes
This should display the node in your cluster (which, in this case, is just the local machine).
Step 7: Verify and Test the Cluster
To ensure everything is working correctly, run the following commands to verify that your cluster is functioning:
microk8s kubectl get pods --all-namespaces
This will show you all running pods across all namespaces.
Conclusion:
By following these steps, you will have a working MicroK8s Kubernetes cluster on Ubuntu. You can now deploy applications and use the Kubernetes features on your system or clusters.