Installing Prometheus on Metalstack Cloud

Felix Roider 29. October 2024 Technology 20 Minuten Lesezeit

Introduction

Prometheus is an essential open-source monitoring solution for cloud-native environments. It uses a pull-based model to collect metrics and stores them in a time-series database with powerful querying (PromQL) and alerting capabilities.

This guide demonstrates how to deploy Prometheus on Metalstack Cloud using the kube-prometheus-stack Helm chart, which bundles Prometheus, Grafana, and Alertmanager in a configuration designed specifically for Kubernetes.

What is kube-prometheus-stack?

The kube-prometheus-stack is a comprehensive Helm chart providing integrated Kubernetes monitoring. It combines:

  • Prometheus – metric collection and storage
  • Grafana – visualization
  • Alertmanager – alert routing and management

The chart ships pre-configured with dashboards, recording rules, and alerting rules, enabling cluster and application monitoring from day one.

Prerequisites

  • Kubernetes 1.19+ (this guide uses version 1.28.13)
  • Helm 3.x

Installation

1. Add the Helm Repository

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

2. Install the Chart

helm install [RELEASE_NAME] prometheus-community/kube-prometheus-stack

The chart includes three dependent charts by default:

  • prometheus-community/kube-state-metrics
  • prometheus-community/prometheus-node-exporter
  • grafana/grafana

3. Upgrade

helm upgrade [RELEASE_NAME] prometheus-community/kube-prometheus-stack

4. Uninstall

helm uninstall [RELEASE_NAME]

Then manually delete the Custom Resource Definitions:

kubectl delete crd alertmanagerconfigs.monitoring.coreos.com
kubectl delete crd alertmanagers.monitoring.coreos.com
kubectl delete crd podmonitors.monitoring.coreos.com
kubectl delete crd probes.monitoring.coreos.com
kubectl delete crd prometheusagents.monitoring.coreos.com
kubectl delete crd prometheuses.monitoring.coreos.com
kubectl delete crd prometheusrules.monitoring.coreos.com
kubectl delete crd scrapeconfigs.monitoring.coreos.com
kubectl delete crd servicemonitors.monitoring.coreos.com
kubectl delete crd thanosrulers.monitoring.coreos.com

Considerations for Metalstack Cloud

Enable the Prometheus Operator

prometheusOperator:
  enabled: true

Retention and Replication

For production deployments, configure retention and replica anti-affinity:

prometheus:
  prometheusSpec:
    retention: 14d
    replicas: 3
    affinity:
      podAntiAffinity:
        requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchLabels:
                app: prometheus
            topologyKey: kubernetes.io/hostname

Storage

Use the csi-lvm storage class provided by Metalstack Cloud for optimal performance on local NVMe SSDs:

storageSpec:
  volumeClaimTemplate:
    spec:
      storageClassName: csi-lvm

Conclusion

The kube-prometheus-stack delivers flexibility and seamless Kubernetes monitoring integration. iSecNG leverages Metalstack Cloud infrastructure to host its Managed SIEM, using the platform’s high-performance capabilities and scalable storage to deliver reliable Managed Detection and Response services.

Machen Sie schon heute den ersten Schritt

Unser Managed Detection & Response Service schützt Ihr Unternehmen unkompliziert vor Bedrohungen.

✉ Anfragen