Course contentsShow
← Docker, Kubernetes & CI/CD
Lesson 541 of 8028. Security and ObservabilityFree lesson

Installing Prometheus via Helm Charts

Deploy the Prometheus server into your Kubernetes cluster using Helm to establish a centralized metric collection engine.

In this lesson, you will learn how to deploy the Prometheus server into your Kubernetes cluster using Helm to establish a centralized metric collection engine.

The Role of Prometheus in Observability

Up until now, we have focused heavily on securing our cluster infrastructure. Now, we turn to observability. To understand the "health" of your secure environment, you need a centralized engine that collects, stores, and queries time-series data from your pods and nodes. Prometheus is the industry-standard tool for this, and the most efficient way to deploy it is via the kube-prometheus-stack Helm chart.

Installing with Helm

Helm allows us to package complex Kubernetes manifests into a single, versioned installation. By using the community-maintained chart, we avoid manually configuring dozens of ClusterRoles, ServiceAccounts, and ConfigMaps.

To get started, add the repository and install the chart into a dedicated monitoring namespace:

# Add the Prometheus community helm repo
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update

# Create the monitoring namespace
kubectl create namespace monitoring

# Install the stack
helm install prometheus prometheus-community/kube-prometheus-stack --namespace monitoring

Why Helm for Prometheus?

Installing Prometheus manually is error-prone. By using a Helm chart, you benefit from "batteries-included" configurations:

  1. Service Discovery: The chart automatically configures Prometheus to discover your application pods via Kubernetes API labels, ensuring that new services are scraped automatically without manual restarts.
  2. Alertmanager Integration: It bundles Alertmanager, allowing you to define routing rules for critical security or performance events.
  3. Grafana Dashboards: It includes pre-built dashboards, giving you instant visualization of the metrics being collected.

Once the installation completes, the Prometheus operator will reconcile the state of the cluster, creating a dedicated Prometheus custom resource. You can verify that your monitoring pods are running by executing kubectl get pods -n monitoring. This centralized engine is now ready to receive data from your pods, effectively closing the loop between your security policies and your operational visibility.

Key Takeaway: Using Helm to deploy the Prometheus stack centralizes your metric collection infrastructure, allowing for automated service discovery and standardized monitoring across your entire Kubernetes cluster.