Prometheus monitoring stack on Ubuntu 22.04.3 and Micro Kubernetes Cluster (microk8s)Prometheus monitoring stack on Ubuntu 22.04.3 and

1) Install Ubuntu 22.04.3 desktop

2) Configure RDP and VNC – – fix the lock problem

3) Install docker

sudo apt install

4) Check docker version

docker --version

5) Create a Micro Kubernetes Cluster (microk8s)

See here:

sudo snap install microk8s --classic --channel=1.27

MicroK8s creates a group to enable seamless usage of commands which require admin privilege. To add your current user to the group and gain access to the .kube caching directory, run the following two commands:

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

See the node:

microk8s kubectl get nodes

See the running services:

microk8s kubectl get services

Create an alias:

alias kubectl='microk8s kubectl'

Deploy an app:

microk8s kubectl create deployment nginx --image=nginx
microk8s kubectl get pods

Starting and Stopping MicroK8s:

microk8s stop
microk8s start

6) export the cluster configuration

kubectl config view --raw > ~/.kube/config

7) Install helm

$ curl -fsSL -o
$ chmod 700
$ ./

8) Deploy Prometheus monitoring stack to Kubernetes with a single Helm Chart


helm repo add prometheus-community
kubectl create ns prom
helm search repo prometheus-community
helm install prometheus prometheus-community/kube-prometheus-stack -n prom

helm install ksm prometheus-community/kube-state-metrics -n default # install the kube-state-metrics

kubectl --namespace prom get pods

Check configmaps and secrets:

kubectl --namespace prom get configmap
kubectl --namespace prom get secret

Look inside a secret file:

kubectl --namespace prom get secret

Check CRDs

kubectl get crd

9) Access Prometheus Dashboard

$ kubectl port-forward -n prom prometheus-prom-kube-prometheus-stack-prometheus-0 9090

10) Access Grafana Dashboard

$ kubectl port-forward -n prom prometheus-grafana-dcb6cdfb4-kbvpk 3000


$ kubectl port-forward -n prom deployment/prometheus-grafana 3000

default user/password is admin/prom-operator

11) Uninstall Prometheus stack

$ helm uninstall prom -n prom

Leave a Reply