Install Prometheus and Grafana on Kubernetes with Helm

Deploy kube-prometheus-stack with deliberate storage and access settings, then verify targets and plan chart upgrades.

Best practices
Illustration of metrics, monitoring, and technical investigation

The kube-prometheus-stack Helm Chart packages Prometheus Operator, Prometheus, Grafana, Alertmanager, and commonly used Kubernetes collectors, dashboards, and rules. It provides a coordinated starting point; production storage, credentials, notifications, and target coverage still need configuration.

Check the selected chart's Kubernetes and Helm requirements, your cluster permissions, and available StorageClasses before installing. The stack does not automatically include every Prometheus ecosystem component, such as Prometheus Adapter or Blackbox Exporter.

Select a chart version and prepare values

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm search repo prometheus-community/kube-prometheus-stack --versions
kubectl get storageclass

Choose a compatible version from the output and set CHART_VERSION to that exact value in your shell. Inspect its values:

: "${CHART_VERSION:?Set the exact chart version to install}"
helm show values prometheus-community/kube-prometheus-stack \
  --version "$CHART_VERSION" > chart-defaults.yaml

For a cluster with a suitable default StorageClass, a starting values.yaml is:

prometheus:
  prometheusSpec:
    retention: 15d
    storageSpec:
      volumeClaimTemplate:
        spec:
          accessModes: [ReadWriteOnce]
          resources:
            requests:
              storage: 50Gi

grafana:
  persistence:
    enabled: true
    size: 5Gi

alertmanager:
  config:
    route:
      receiver: discard
      group_by: [namespace]
    receivers:
      - name: discard

This intentionally defines a valid receiver that sends no notifications. Configure a real receiver and test delivery before relying on the stack for incident response. A route naming a receiver without defining it is invalid.

If there is no appropriate default StorageClass, set the chart's explicit storage-class fields for your environment. Size these volumes from measured ingestion and usage. Prometheus data is not durable across Pod replacement when it uses ephemeral storage. Alertmanager persistence, when needed for its operational state, is configured separately under its spec.

Install and verify

: "${CHART_VERSION:?Set the exact chart version to install}"
helm install monitoring prometheus-community/kube-prometheus-stack \
  --version "$CHART_VERSION" \
  --namespace monitoring --create-namespace \
  --values values.yaml --wait --timeout 10m

kubectl get pods,pvc -n monitoring
helm status monitoring -n monitoring

Investigate Pending PVCs, image pulls, scheduling constraints, and Operator events if installation does not settle. A ready release does not prove that every scrape, alert, or notification works; inspect Prometheus Targets and issue a known metric query.

Access Grafana

For the default naming of this release:

kubectl get secret -n monitoring monitoring-grafana \
  -o jsonpath='{.data.admin-password}' | base64 --decode
kubectl port-forward -n monitoring svc/monitoring-grafana 3000:80

The decode command shown is for GNU base64; on macOS use base64 -D. Use the configured admin user, commonly admin, and avoid copying credentials into shared logs. An existing-secret override or renamed release changes the credential lookup. Check the chart's generated names and authentication configuration.

Use HTTPS and appropriate authentication before exposing Grafana beyond local port forwarding. Manage production credentials with the chart's supported Secret integration rather than committing adminPassword in a values file.

Common questions

Should I use separate Prometheus and Grafana charts? The stack reduces the integration work for Operator-based Kubernetes monitoring. Separate charts can fit an existing monitoring architecture or a narrower deployment. Neither choice removes the need to own storage and upgrades.

Does keeping values.yaml make upgrades safe? It preserves your declared overrides, but does not back up persistent data or eliminate breaking changes. Pin and review the new chart version, follow its CRD upgrade instructions, render/review changes, back up needed data, and test the upgrade. Helm does not generally update CRDs from the crds/ directory automatically.

References

Get a tailored plan

Contact us

Join the community

Scan with WeChat
to join the community

Try Guance

Start online and pay only for what you use.

Get started

Choose a Guance plan

Code hosting