Skip to content

About

Monitoring Stack of Lightweight Kubernetes cluster using K3s on a virtual machine, deploys a Prometheus monitoring stack via Helm, and exposes both Grafana and Prometheus dashboards using NodePort.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Helm Charts x K3s Monitoring Stack with Prometheus & Grafana

This guide sets up a lightweight Kubernetes cluster using K3s on a virtual machine, deploys a Prometheus monitoring stack via Helm, and exposes both Grafana and Prometheus dashboards using NodePort. image

# Create environment script
cat <<EOF > k3s-env.sh
#!/bin/bash
export INSTALL_K3S_CHANNEL=stable
export INSTALL_K3S_EXEC="--disable=traefik --disable=servicelb --disable=metrics-server"
export K3S_KUBECONFIG_MODE="644"
export INSTALL_K3S_NAME="k3s"
EOF
chmod +x k3s-env.sh
source ./k3s-env.sh

Install K3s

curl -sfL https://get.k3s.io | sh -
kubectl get nodes

k3s 1

Configure kubectl access

mkdir -p ~/.kube
sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
sudo chown $USER:$USER ~/.kube/config

Install Helm

curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
helm version

Add Prometheus Helm repository

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

Install Prometheus monitoring stack

helm install prometheus prometheus-community/kube-prometheus-stack \
  --set grafana.persistence.enabled=true \
  --set grafana.persistence.size=2Gi \
  --set grafana.adminUser="admin" \
  --set grafana.adminPassword="prom_operator" \
  --set grafana.grafana.ini.database.wal=true

#Alternatively you can put all the dependables into a yaml file and apply during the install

k3s namespace x depl

k3s all

Expose Grafana using NodePort

kubectl patch svc prometheus-grafana -p '{"spec": {"type": "NodePort"}}'
kubectl get svc prometheus-grafana
# Note the NodePort (e.g. 32185)

Access Grafana in browser

# URL format: http://<VM_IP>:<NodePort>
# Example: http://100.91.78.70:32185

grafana ui

ui 2

Grafana credentials:

  • Username: admin
  • Password: prom_operator

Screenshot_4-7-2025_141559_100 91 78 70

Expose Prometheus using NodePort

kubectl patch svc prometheus-kube-prometheus-prometheus -p '{"spec": {"type": "NodePort"}}'
kubectl get svc prometheus-kube-prometheus-prometheus
# Note the NodePort (e.g. 32290)

Access Prometheus in browser

URL format: http://<VM_IP>:
Example: http://100.91.78.70:32290

prom ui

Screenshot_4-7-2025_142425_100 91 78 70

About

Monitoring Stack of Lightweight Kubernetes cluster using K3s on a virtual machine, deploys a Prometheus monitoring stack via Helm, and exposes both Grafana and Prometheus dashboards using NodePort.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages