Join our Discord Server
Adesoji Alu Adesoji brings a proven ability to apply machine learning(ML) and data science techniques to solve real-world problems. He has experience working with a variety of cloud platforms, including AWS, Azure, and Google Cloud Platform. He has a strong skills in software engineering, data science, and machine learning. He is passionate about using technology to make a positive impact on the world.

Installing Prometheus on MicroK8s in 2025: A Step-by-Step Guide

1 min read

Introduction

Monitoring and alerting are crucial aspects of managing Kubernetes clusters. Prometheus is a powerful open-source monitoring and alerting toolkit that is widely used in Kubernetes environments. This guide explains how to successfully install Prometheus on MicroK8s and solve the common TLS certificate issue that may arise during the process.

Prerequisites

Resolving TLS Certificate Issues in MicroK8s

word-image-30071-1

Before installing Prometheus, you may encounter the following error:

Error: INSTALLATION FAILED: Kubernetes cluster unreachable: Get "https://<cluster-ip>:16443/version": tls: failed to verify certificate: x509: certificate signed by unknown authority
  1. Copy the MicroK8s CA Certificate:
    sudo cp /var/snap/microk8s/current/certs/ca.crt /usr/local/share/ca-certificates/
  2. Update the System Certificates:
    sudo update-ca-certificates

You should see an output indicating that the certificate has been added:

Updating certificates in /etc/ssl/certs...

1 added, 0 removed; done.
3. Generate the kubeconfig File:
microk8s config > ~/.kube/config

Having followed these steps, you ensure that the Helm client can authenticate with the Kubernetes API server.

Installing Prometheus on MicroK8s

Once the TLS issue is resolved, you can proceed with the Prometheus installation.

Step 1: Add the Prometheus Helm Chart Repository

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update

Step 2: Install Prometheus

word-image-30071-4
helm install my-prom prometheus-community/prometheus

Expected Output

If the installation is successful, you will see an output similar to this:

NAME: my-prom
LAST DEPLOYED: <date and time>
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None

NOTES:
The Prometheus server can be accessed via port 80 on the following DNS name from within your cluster:

my-prom-prometheus-server.default.svc.cluster.local

Get the Prometheus server URL by running these commands in the same shell:

export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=prometheus,app.kubernetes.io/instance=my-prom" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace default port-forward $POD_NAME 9090

Step 3: Verify the Installation

Run the following command to check the Prometheus pods:

kubectl get pods --namespace default

Step 4: Access Prometheus

Forward the Prometheus server port to access it in your local browser:

export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=prometheus,app.kubernetes.io/instance=my-prom" -o jsonpath="{.items[0].metadata.name}")

kubectl --namespace default port-forward $POD_NAME 9090

Visit http://localhost:9090 in your browser to access the Prometheus interface.

Conclusion

By following this guide, you have successfully installed Prometheus on MicroK8s and resolved TLS certificate issues. This setup allows you to monitor your Kubernetes cluster effectively. Prometheus provides a robust foundation for building advanced monitoring and alerting systems, helping you ensure your cluster’s health and performance.

References

Have Queries? Join https://launchpass.com/collabnix

Adesoji Alu Adesoji brings a proven ability to apply machine learning(ML) and data science techniques to solve real-world problems. He has experience working with a variety of cloud platforms, including AWS, Azure, and Google Cloud Platform. He has a strong skills in software engineering, data science, and machine learning. He is passionate about using technology to make a positive impact on the world.
Join our Discord Server
Index