Try It Out
In this example we will deploy kube-state-metrics on a Kubernetes cluster using the Minimus kube-state-metrics Helm chart. kube-state-metrics will expose Prometheus-style metrics about the state of your Kubernetes objects.
Step 1: Start Cluster
If you have a cluster to work with, skip this step. Otherwise, start a Minikube cluster. Deployment instructions
Step 2: Create Secret
First, create a namespace:
kubectl create ns kube-state-metrics
Next, create a Kubernetes secret for the Minimus token so Helm will be able to pull images from the Minimus registry:
kubectl create secret docker-registry minimus-registry \
--docker-server=reg.mini.dev \
--docker-username=minimus \
--docker-password={token} \
--namespace=kube-state-metrics
Step 3: Deploy the Helm Chart
Deploy the Minimus Helm chart:
helm install my-kube-state-metrics oci://helm.mini.dev/kube-state-metrics \
-n kube-state-metrics \
--wait
If you want to override the chart's defaults, go to the Values tab, save a copy locally with your changes. Deploy the chart with your overrides using -f values.yaml:
helm install my-kube-state-metrics oci://helm.mini.dev/kube-state-metrics \
-f values.yaml \
-n kube-state-metrics \
--wait
Step 4: Verify kube-state-metrics is Running
Confirm the chart deployed successfully and kube-state-metrics started:
kubectl get pods -n kube-state-metrics
You should see output similar to:
NAME READY STATUS RESTARTS AGE
my-kube-state-metrics-xxxxxxxxx-xxxxx 1/1 Running 0 2m
Step 5: Test HTTP Endpoint
Forward the kube-state-metrics service port to your local machine:
kubectl port-forward svc/my-kube-state-metrics -n kube-state-metrics 8080:8080
In another terminal, verify the health endpoint responds:
curl -sf http://localhost:8080/healthz
Then check that Prometheus metrics are being exposed:
curl -s http://localhost:8080/metrics | head -20
You should see Prometheus-formatted metrics including lines like:
# HELP kube_pod_info Information about pod.
# TYPE kube_pod_info gauge
kube_pod_info{...} 1
Step 6: Clean Up
Uninstall the chart and delete the namespace to remove all resources:
helm uninstall my-kube-state-metrics -n kube-state-metrics
kubectl delete namespace kube-state-metrics