Article 2: Installing and Configuring MicroK8s
Woulf

Woulf @woulf

Joined:
Mar 3, 2025

Article 2: Installing and Configuring MicroK8s

Publish Date: Jun 26
0 0

Setting up my local Kubernetes cluster with MicroK8s – installation, network configuration, activation of key modules, and secure access through UFW.

Now that the project foundation is laid, it’s time to set up the Kubernetes infrastructure on my VPS using MicroK8s.

This will be the technical base on which I’ll deploy my portfolio.


Step 1 - Installing MicroK8s

I start by installing MicroK8s using the snap package manager (already present on Ubuntu):

sudo snap install microk8s --classic
Enter fullscreen mode Exit fullscreen mode

Step 2 - Adding My User

By default, all microk8s commands require sudo.

To get rid of that, I add my user to the microk8s group:

sudo usermod -a -G microk8s $USER
newgrp microk8s
Enter fullscreen mode Exit fullscreen mode

Step 3 - Verifying Installation

I check that the cluster is properly installed and ready:

microk8s status --wait-ready
Enter fullscreen mode Exit fullscreen mode

Step 4 - Enabling Essential Modules

I enable the following components:

microk8s enable dns ingress storage
Enter fullscreen mode Exit fullscreen mode

Quick explanations:

  • dns: internal name resolution within the cluster
  • ingress: Ingress Controller (nginx reverse proxy)
  • storage: management of persistent volumes

Step 5 - Testing the Cluster

I verify everything is working with:

microk8s kubectl get all -A
Enter fullscreen mode Exit fullscreen mode

Step 6 - Using kubectl Without microk8s Prefix

To use kubectl directly without prefix, I export the config:

microk8s config > ~/.kube/config
Enter fullscreen mode Exit fullscreen mode

Step 7 - Opening Ports with UFW

I configure the firewall (ufw) to allow necessary connections:

sudo ufw allow 22/tcp     # SSH
sudo ufw allow 80,443/tcp # HTTP / HTTPS (Ingress)
sudo ufw allow 16443/tcp  # Kubernetes API
sudo ufw enable
Enter fullscreen mode Exit fullscreen mode

Cluster Ready 🚀

The Kubernetes cluster is now ready to host my upcoming deployments.

In the next article, I’ll focus on building the Docker image for my site and setting up the first CI/CD pipeline to automatically publish it.

Comments 0 total

    Add comment