Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use Prometheus to monitor Kubernetes and applications running on Kubernetes

License

NotificationsYou must be signed in to change notification settings

prometheus-operator/kube-prometheus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Build StatusSlack

Warning

Everything is experimental and may change significantly at any time.

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

The content of this project is written injsonnet. 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 thekubernetes-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 aServiceAccount token can be used to authenticate against the kubelet(s). This can also be enabled by setting the kubelet configuration valueauthentication.webhook.enabled totrue.
  • --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 valueauthorization.mode toWebhook.

This stack providesresource metrics by deployingthePrometheus Adapter.This adapter is an Extension API Server and Kubernetes needs to be have this feature enabled, otherwise the adapter hasno 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 stackKubernetes 1.29Kubernetes 1.30Kubernetes 1.31Kubernetes 1.32Kubernetes 1.33Kubernetes 1.34
release-0.14xxx
release-0.15xxx
release-0.16xx
mainxxx

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 Kubernetesmanifests generated with this library (specifically withexample.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 themanifests 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/setupkubectlwait \    --for condition=Established \    --all CustomResourceDefinition \    --namespace=monitoringkubectl 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 commandkubectl apply --server-side -f manifests/setup -f manifests, but it may be necessary to run the command multiple times for all components tobe created successfully.

  • To teardown the stack:

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

Theofficial documentation contains the full version of this quick-start guide, and includesinstructions on how to access Prometheus, AlertManager, and Grafana.

minikube

To try out this stack, startminikube 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 todocs/ directory.

Contributing

To contribute to kube-prometheus, refer toContributing.

Join the discussion

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

License

Apache License 2.0, seeLICENSE.


[8]ページ先頭

©2009-2025 Movatter.jp