Skip to content

AlejandroSobral/Prometheus-Operator-Kind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Prometheus-Operator

This repo provides guidance about how to setup a Prometheus Operator stack using Helm and a local kind cluster.

Prom-logo

Disclaimer:

Basic Kubernetes, Prometheus and Helm knowledge is assumed.

 


Pre requisites: Setup Cluster locally using Kind

Cluster local setup

The following table shows the versions used.

Component Detail
Operating System Ubuntu 22.04.5 LTS
kind v0.30.0 (go1.24.6, linux/amd64)
kubectl (Client) v1.31.1
Kustomize v5.4.2
Kubernetes (Server) v1.34.0

 

Use kind to setup a tiny local multi-node K8s cluster as follows:

sudo apt install golang-go # Install Go
sudo apt install -y docker.io # Install Docker Engine

# LINUX ONLY!
# For AMD64 / x86_64
[ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.30.0/kind-linux-amd64
# For ARM64
[ $(uname -m) = aarch64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.30.0/kind-linux-arm64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind

## Setup this way, so as not to override any existing config
kind create cluster \
  --kubeconfig ~/.kube/kind/kind-lab.config  \
  --config kind-cluster-config/kind-cluster.yaml

If you have more than one cluster configured, keep this handy to use as reference:

export KUBECONFIG=:~/.kube/debian.config
export KUBECONFIG=:~/.kube/kind/kind-lab.config

 

Prometheus setup using Helm chart

Helm-logo

Resources

The following resources have been used as reference or as source.

Kube-Prometheus installation (0)

Helm-chart Repo

The guide

# Setup Prom repo in Helm
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts

# List the latest 10 available versions
helm search repo prometheus-community --versions \
| grep -i '^prometheus-community/kube-prometheus-stack' \
| head -10

CHART_VERSION=80.4.1 # Pick the version that suits your needs.

helm install kube-prometheus-stack prometheus-community/kube-prometheus-stack \
  --version ${CHART_VERSION} \
  --namespace monitoring \
  --create-namespace \
  --values Operator/values.yaml


NAME: kube-prometheus-stack
LAST DEPLOYED: Tue Dec 23 10:23:07 2025
NAMESPACE: monitoring
STATUS: deployed
REVISION: 1
NOTES:

Once the stack is deployed, remember that the Pods are not accesible from outside the cluster.

Therefore, keep this port-forward handy to access the resources:

k -n monitoring port-forward grafana-65dc94d75f-fhprc 3000:3000 
k -n monitoring port-forward prometheus-kube-prometheus-stack-prometheus-0 9090:9090
k port-forward svc/hello-world-svc -n web-app 8080:80

To test the behaviour, a simple "web-app" has been included. It is expected that Prometheus get noticed and start scraping its metrics once deployed.

Create the web-app resources:

k apply -f Operator/web-app.yaml

Check the status:

Web-app working:

web-app-working

 

Target updated:

target-updated

 

Prometheus web-app status example:

target-updated
up{namespace="web-app", job=~".*hello-world.*"}

 

Web-app metrics exposed:

target-updated

About

This repo provides guidance about how to locally setup a Prometheus Operator stack from scratch

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors