🚀 Installation & Setup

Prometheus Installation Guide

Deploy a complete Prometheus monitoring stack in Kubernetes using the Prometheus Operator. Learn best practices for production-ready monitoring setup.

Installation Steps

Prometheus Operator Setup

Deploy Prometheus Operator using Helm or kubectl

The Prometheus Operator provides Kubernetes native deployment and management of Prometheus and related monitoring components.

$ helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
$ helm repo update
$ helm install prometheus prometheus-community/kube-prometheus-stack --namespace monitoring --create-namespace

ServiceMonitor Configuration

Configure ServiceMonitor to scrape metrics from your applications

ServiceMonitor resources define how Prometheus should discover and scrape metrics from your services.

$ apiVersion: monitoring.coreos.com/v1
$ kind: ServiceMonitor
$ metadata:
$ name: my-app-monitor
$ namespace: monitoring

Grafana Dashboard Setup

Configure Grafana with pre-built Kubernetes dashboards

Grafana provides rich visualization capabilities with pre-configured dashboards for Kubernetes monitoring.

$ kubectl port-forward svc/prometheus-grafana 3000:80 -n monitoring
$ # Access Grafana at http://localhost:3000
$ # Default credentials: admin/prom-operator

Alert Rules Configuration

Set up PrometheusRule resources for alerting

Define alerting rules using PrometheusRule custom resources for comprehensive monitoring.

$ apiVersion: monitoring.coreos.com/v1
$ kind: PrometheusRule
$ metadata:
$ name: kubernetes-alerts

Monitoring Stack Components

Prometheus Server

Core metrics collection and storage engine

Key Features:

Time-series database
PromQL query engine
Web UI
Alert rule evaluation

Grafana

Visualization and dashboard platform

Key Features:

Dashboard creation
Panel types
Data source management
User authentication

Alertmanager

Alert routing and notification management

Key Features:

Alert routing
Grouping and inhibition
Notification channels
Silencing

Node Exporter

Hardware and OS metrics exporter

Key Features:

CPU metrics
Memory usage
Disk I/O
Network statistics

Verification Steps

Post-Installation Verification

Ensure your Prometheus monitoring stack is properly configured and running.

  • Check all pods are running in monitoring namespace
  • Verify ServiceMonitor resources are created
  • Access Prometheus UI to see targets
  • Confirm Grafana dashboards are loading
  • Test alert rule evaluation

Quick Commands

Essential kubectl Commands

Common commands for managing your Prometheus monitoring stack.

Check Pod Status

$ kubectl get pods -n monitoring

Access Prometheus UI

$ kubectl port-forward svc/prometheus-kube-prometheus-prometheus 9090:9090 -n monitoring

Access Grafana UI

$ kubectl port-forward svc/prometheus-grafana 3000:80 -n monitoring

Ready for Next Steps?

Now that Prometheus is installed, learn how to create comprehensive dashboards and configure alerting.