Use Prometheus to monitor Kubernetes and applications running on Kubernetes
Go to file
Simon Pasquier 2fe94c3379
Merge pull request #2704 from rexagod/make-update
chore: `make update`
2025-07-29 15:17:14 +02:00
.github ci: Attempt harden update versions script (#2696) 2025-07-22 13:42:37 +01:00
developer-workspace Update README.md (#2583) 2025-05-16 13:13:59 +01:00
docs Release-0.15 follow-up PR (#2674) 2025-06-05 10:11:37 +01:00
examples Argo-CD example improvements (#2200) 2023-08-31 22:21:19 +01:00
experimental/metrics-server Update apiVersion from deprecated RBAC 2022-02-10 17:42:04 +00:00
jsonnet/kube-prometheus [bot] [main] Automated version update (#2705) 2025-07-28 11:56:55 +00:00
manifests [bot] [main] Automated version update (#2705) 2025-07-28 11:56:55 +00:00
scripts ci: Harden the get changelog func (#2699) 2025-07-22 17:07:25 +01:00
tests/e2e chore: move kind configs to test/e2e folder 2025-05-19 19:01:48 +05:30
.gitignore Update mdox version 2022-07-27 17:28:08 +02:00
.gitpod.yml Better ephemeral workspace support with Codespaces 2021-09-30 21:00:50 +00:00
.mdox.validate.yaml Release-0.15 follow-up PR (#2674) 2025-06-05 10:11:37 +01:00
build.sh *: update jsonnet to use prometheus-operator v0.39 2020-05-11 11:59:46 +02:00
CHANGELOG.md chore: fix changelog formatting 2025-06-04 14:32:05 +05:30
code-of-conduct.md Add mdox link checking and formatting 2021-10-21 19:12:33 +05:30
CONTRIBUTING.md Add exception for PromOperator's twitter profile (#2321) 2024-01-03 17:14:21 +00:00
example.jsonnet Add Pyrra as addon and commented out example.jsonnet parts 2022-03-30 21:20:13 +02:00
go.mod build(deps): bump k8s.io/client-go from 0.33.2 to 0.33.3 2025-07-16 22:30:38 +00:00
go.sum build(deps): bump k8s.io/client-go from 0.33.2 to 0.33.3 2025-07-16 22:30:38 +00:00
jsonnetfile.json Add missing dependency 2024-04-13 00:00:57 +02:00
jsonnetfile.lock.json chore: make update 2025-07-29 00:03:39 +05:30
kubescape-exceptions.json kubescape: Add exception for Prometheus SA automount of token 2022-08-02 20:37:55 +01:00
kustomization.yaml [bot] [main] Automated version update (#2111) 2023-05-15 11:32:29 +01:00
LICENSE update CoC and legalese 2018-01-04 12:34:16 -08:00
Makefile chore: update kubernetes version for validations 2025-05-19 21:13:17 +05:30
README.md Release-0.15 follow-up PR (#2674) 2025-06-05 10:11:37 +01:00
RELEASE.md Release-0.15 follow-up PR (#2674) 2025-06-05 10:11:37 +01:00

kube-prometheus

Build Status Slack Gitpod ready-to-code

Warning

Everything is experimental and may change significantly at any time.

This repository collects Kubernetes manifests, Grafana dashboards, and Prometheus rules combined with documentation and scripts to provide easy to operate end-to-end Kubernetes cluster monitoring with Prometheus using the Prometheus Operator.

The content of this project is written in jsonnet. This project could both be described as a package as well as a library.

Components included in this package:

This stack is meant for cluster monitoring, so it is pre-configured to collect metrics from all Kubernetes components. In addition to that it delivers a default set of dashboards and alerting rules. Many of the useful dashboards and alerts come from the kubernetes-mixin project, similar to this project it provides composable jsonnet as a library for users to customize to their needs.

Prerequisites

You will need a Kubernetes cluster, that's it! By default it is assumed, that the kubelet uses token authentication and authorization, as otherwise Prometheus needs a client certificate, which gives it full access to the kubelet, rather than just the metrics. Token authentication and authorization allows more fine grained and easier access control.

This means the kubelet configuration must contain these flags:

  • --authentication-token-webhook=true This flag enables, that a ServiceAccount token can be used to authenticate against the kubelet(s). This can also be enabled by setting the kubelet configuration value authentication.webhook.enabled to true.
  • --authorization-mode=Webhook This flag enables, that the kubelet will perform an RBAC request with the API to determine, whether the requesting entity (Prometheus in this case) is allowed to access a resource, in specific for this project the /metrics endpoint. This can also be enabled by setting the kubelet configuration value authorization.mode to Webhook.

This stack provides resource metrics by deploying the Prometheus Adapter. This adapter is an Extension API Server and Kubernetes needs to be have this feature enabled, otherwise the adapter has no effect, but is still deployed.

Compatibility

The following Kubernetes versions are supported and work as we test against these versions in their respective branches. But note that other versions might work!

Note

In CI we will be testing only last two releases and main branch on a regular basis.

kube-prometheus stack Kubernetes 1.27 Kubernetes 1.28 Kubernetes 1.29 Kubernetes 1.30 Kubernetes 1.31 Kubernetes 1.32 Kubernetes 1.33
release-0.13 x x x x x
release-0.14 x x x x
release-0.15 x x x x
main x x x x

Quickstart

This project is intended to be used as a library (i.e. the intent is not for you to create your own modified copy of this repository).

Though for a quickstart a compiled version of the Kubernetes manifests generated with this library (specifically with example.jsonnet) is checked into this repository in order to try the content out quickly. To try out the stack un-customized run:

  • Create the monitoring stack using the config in the manifests directory:

    # Create the namespace and CRDs, and then wait for them to be available before creating the remaining resources
    # Note that due to some CRD size we are using kubectl server-side apply feature which is generally available since kubernetes 1.22.
    # If you are using previous kubernetes versions this feature may not be available and you would need to use kubectl create instead.
    kubectl apply --server-side -f manifests/setup
    kubectl wait \
        --for condition=Established \
        --all CustomResourceDefinition \
        --namespace=monitoring
    kubectl apply -f manifests/
    

We create the namespace and CustomResourceDefinitions first to avoid race conditions when deploying the monitoring components. Alternatively, the resources in both folders can be applied with a single command kubectl apply --server-side -f manifests/setup -f manifests, but it may be necessary to run the command multiple times for all components to be created successfully.

  • To teardown the stack:

    kubectl delete --ignore-not-found=true -f manifests/ -f manifests/setup
    

The official documentation contains the full version of this quick-start guide, and includes instructions on how to access Prometheus, AlertManager, and Grafana.

minikube

To try out this stack, start minikube with the following command:

minikube delete && minikube start --container-runtime=containerd --kubernetes-version=v1.33.1 --memory=6g --bootstrapper=kubeadm --extra-config=kubelet.authentication-token-webhook=true --extra-config=kubelet.authorization-mode=Webhook --extra-config=scheduler.bind-address=0.0.0.0 --extra-config=controller-manager.bind-address=0.0.0.0

The kube-prometheus stack includes a resource metrics API server, so the metrics-server addon is not necessary. Ensure the metrics-server addon is disabled on minikube:

minikube addons disable metrics-server

Getting started

Before deploying kube-prometheus in a production environment, read:

  1. Customizing kube-prometheus
  2. Customization examples
  3. Accessing Graphical User Interfaces
  4. Troubleshooting kube-prometheus

Documentation

  1. Continuous Delivery
  2. Update to new version
  3. For more documentation on the project refer to docs/ directory.

Contributing

To contribute to kube-prometheus, refer to Contributing.

Join the discussion

If you have any questions or feedback regarding kube-prometheus, join the kube-prometheus discussion. Alternatively, consider joining #prometheus-operator slack channel or project's bi-weekly Contributor Office Hours.

License

Apache License 2.0, see LICENSE.