# Prometheus Operator
[![Build Status](https://github.com/prometheus-operator/prometheus-operator/workflows/ci/badge.svg)](https://github.com/prometheus-operator/prometheus-operator/actions)
[![Go Report Card](https://goreportcard.com/badge/prometheus-operator/prometheus-operator "Go Report Card")](https://goreportcard.com/report/prometheus-operator/prometheus-operator)
[![Slack](https://img.shields.io/badge/join%20slack-%23prometheus--operator-brightgreen.svg)](http://slack.k8s.io/)
**Project status: *beta*** Not all planned features are completed. The API, spec, status and other user facing objects may change, but in a backward compatible way.
Note: Project was previously known as coreos/prometheus-operator.
## Overview
The Prometheus Operator provides [Kubernetes](https://kubernetes.io/) native deployment and management of
[Prometheus](https://prometheus.io/) and related monitoring components. The purpose of this project is to
simplify and automate the configuration of a Prometheus based monitoring stack for Kubernetes clusters.
The Prometheus operator includes, but is not limited to, the following features:
* **Kubernetes Custom Resources**: Use Kubernetes custom resources to deploy and manage Prometheus, Alertmanager,
and related components.
* **Simplified Deployment Configuration**: Configure the fundamentals of Prometheus like versions, persistence,
retention policies, and replicas from a native Kubernetes resource.
* **Prometheus Target Configuration**: Automatically generate monitoring target configurations based
on familiar Kubernetes label queries; no need to learn a Prometheus specific configuration language.
For an introduction to the Prometheus Operator, see the [getting started](https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/user-guides/getting-started.md) guide.
## Prometheus Operator vs. kube-prometheus vs. community helm chart
### Prometheus Operator
The Prometheus Operator uses Kubernetes [custom resources](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) to simplify the deployment and configuration of Prometheus, Alertmanager, and related monitoring components.
### kube-prometheus
[kube-prometheus](https://github.com/prometheus-operator/kube-prometheus) provides example configurations for a complete cluster monitoring
stack based on Prometheus and the Prometheus Operator. This includes deployment of multiple Prometheus and Alertmanager instances,
metrics exporters such as the node_exporter for gathering node metrics, scrape target configuration linking Prometheus to various
metrics endpoints, and example alerting rules for notification of potential issues in the cluster.
### helm chart
The [prometheus-community/kube-prometheus-stack](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack)
helm chart provides a similar feature set to kube-prometheus. This chart is maintained by the Prometheus community.
For more information, please see the [chart's readme](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack#kube-prometheus-stack)
## Prerequisites
Version `>=0.39.0` of the Prometheus Operator requires a Kubernetes
cluster of version `>=1.16.0`. If you are just starting out with the
Prometheus Operator, it is highly recommended to use the latest version.
If you have an older version of Kubernetes and the Prometheus Operator running,
we recommend upgrading Kubernetes first and then the Prometheus Operator.
## CustomResourceDefinitions
A core feature of the Prometheus Operator is to monitor the Kubernetes API server for changes
to specific objects and ensure that the current Prometheus deployments match these objects.
The Operator acts on the following [custom resource definitions (CRDs)](https://kubernetes.io/docs/tasks/access-kubernetes-api/extend-api-custom-resource-definitions/):
* **`Prometheus`**, which defines a desired Prometheus deployment.
* **`Alertmanager`**, which defines a desired Alertmanager deployment.
* **`ThanosRuler`**, which defines a desired Thanos Ruler deployment.
* **`ServiceMonitor`**, which declaratively specifies how groups of Kubernetes services should be monitored.
The Operator automatically generates Prometheus scrape configuration based on the current state of the objects in the API server.
* **`PodMonitor`**, which declaratively specifies how group of pods should be monitored.
The Operator automatically generates Prometheus scrape configuration based on the current state of the objects in the API server.
* **`Probe`**, which declaratively specifies how groups
of ingresses or static targets should be monitored. The Operator automatically generates Prometheus scrape configuration
based on the definition.
* **`PrometheusRule`**, which defines a desired set of Prometheus alerting and/or recording rules.
The Operator generates a rule file, which can be used by Prometheus instances.
* **`AlertmanagerConfig`**, which declaratively specifies subsections of the Alertmanager configuration, allowing
routing of alerts to custom receivers, and setting inhibit rules.
The Prometheus operator automatically detects changes in the Kubernetes API server to any of the above objects, and ensures that
matching deployments and configurations are kept in sync.
To learn more about the CRDs introduced by the Prometheus Operator have a look
at the [design doc](Documentation/design.md).
To automate validation of your CRD configuration files see about [linting](Documentation/user-guides/linting.md).
## Dynamic Admission Control
To prevent invalid Prometheus alerting and recording rules from causing failures in a deployed Prometheus instance,
an [admission webhook](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/)
is provided to validate `PrometheusRule` resources upon initial creation or update.
For more information on this feature, see the [user guide](Documentation/user-guides/webhook.md).
## Quickstart
**Note:** this quickstart does not provision an entire monitoring stack; if that is what you are looking for,
see the [kube-prometheus](https://github.com/prometheus-operator/kube-prometheus) project. If you want the whole stack,
but have already applied the `bundle.yaml`, delete the bundle first (`kubectl delete -f bundle.yaml`).
To quickly try out _just_ the Prometheus Operator inside a cluster, **choose a release** and run the following command:
```sh
kubectl apply -f bundle.yaml
```
> Note: make sure to adapt the namespace in the ClusterRoleBinding if deploying in a namespace other than the default namespace.
To run the Operator outside of a cluster:
```sh
make
scripts/run-external.sh <kubectl cluster name>
```
## Removal
To remove the operator and Prometheus, first delete any custom resources you created in each namespace. The
operator will automatically shut down and remove Prometheus and Alertmanager pods, and associated ConfigMaps.
```sh
for n in $(kubectl get namespaces -o jsonpath={..metadata.name}); do
kubectl delete --all --namespace=$n prometheus,servicemonitor,podmonitor,alertmanager
done
```
After a couple of minutes you can go ahead and remove the operator itself.
```sh
kubectl delete -f bundle.yaml
```
The operator automatically creates services in each namespace where you created a Prometheus or Alertmanager resources,
and defines three custom resource definitions. You can clean these up now.
```sh
for n in $(kubectl get namespaces -o jsonpath={..metadata.name}); do
kubectl delete --ignore-not-found --namespace=$n service prometheus-operated alertmanager-operated
done
kubectl delete --ignore-not-found customresourcedefinitions \
prometheuses.monitoring.coreos.com \
servicemonitors.monitoring.coreos.com \
podmonitors.monitoring.coreos.com \
alertmanagers.monitoring.coreos.com \
prometheusrules.monitoring.coreos.com
```
## Development
### Prer
没有合适的资源?快使用搜索试试~ 我知道了~
prometheus-operator:Prometheus Operator在Kubernetes上创建配置管理Prometh...
共354个文件
go:172个
yaml:70个
md:36个
需积分: 43 4 下载量 82 浏览量
2021-02-03
05:26:31
上传
评论
收藏 3.31MB ZIP 举报
温馨提示
普罗米修斯算子 项目状态:测试版并非所有计划的功能都已完成。 API,规范,状态和其他面向用户的对象可能会更改,但以向后兼容的方式。 注意:项目以前称为coreos / prometheus-operator。 总览 Prometheus Operator提供对及其相关监视组件的本地部署和管理。 该项目的目的是简化和自动化针对Kubernetes集群的基于Prometheus的监视堆栈的配置。 Prometheus运算符包括但不限于以下功能: Kubernetes自定义资源:使用Kubernetes自定义资源来部署和管理Prometheus,Alertmanager和相关组件。 简化的部署配置:从本地Kubernetes资源配置Prometheus的基础知识,例如版本,持久性,保留策略和副本。 Prometheus目标配置:基于熟悉的Kubernetes标签查询自动生成监视目标配置; 无需学习Prometheus特定的配置语言。 有关Prometheus Operator的介绍,请参阅指南。 普罗米修斯算子vs库伯普罗米修斯vs社区掌舵图 普罗米修斯算子 Promethe
资源详情
资源评论
资源推荐
收起资源包目录
prometheus-operator:Prometheus Operator在Kubernetes上创建配置管理Prometheus集群 (354个子文件)
CODEOWNERS 109B
bad_ca.crt 2KB
ca.crt 2KB
bad_client.crt 2KB
client.crt 2KB
DCO 1KB
Dockerfile 2KB
Dockerfile 384B
Dockerfile 210B
Dockerfile 193B
Dockerfile 85B
.editorconfig 235B
.gitignore 346B
.gitignore 30B
.gitignore 30B
.gitignore 6B
prometheus_test.go 102KB
promcfg_test.go 91KB
types.go 72KB
operator.go 56KB
zz_generated.deepcopy.go 54KB
promcfg.go 48KB
operator.go 42KB
statefulset_test.go 41KB
alertmanager_test.go 36KB
operator_test.go 26KB
statefulset.go 26KB
alertmanager_config_types.go 26KB
operator.go 24KB
amcfg.go 23KB
statefulset_test.go 20KB
zz_generated.deepcopy.go 18KB
store_test.go 18KB
statefulset.go 18KB
statefulset_test.go 18KB
types.go 18KB
main.go 17KB
prometheus.go 16KB
prometheus_instance_namespaces_test.go 16KB
framework.go 16KB
admission_test.go 15KB
statefulset.go 15KB
amcfg_test.go 14KB
thanos_types.go 12KB
alertmanager.go 12KB
operator.go 11KB
main_test.go 10KB
api.go 9KB
rules.go 9KB
rules.go 9KB
k8sutil_test.go 9KB
denylist_test.go 9KB
admission.go 8KB
store.go 8KB
alertmanager_instance_namespaces_test.go 8KB
namespace_denylist_test.go 8KB
k8sutil.go 7KB
alertmanager.go 7KB
thanosruler.go 7KB
prometheus.go 7KB
alertmanagerconfig.go 7KB
factory.go 6KB
servicemonitor.go 6KB
prometheusrule.go 6KB
main.go 6KB
podmonitor.go 6KB
labeler_test.go 6KB
informers_test.go 6KB
probe.go 6KB
types_test.go 6KB
informers.go 6KB
fake_alertmanager.go 6KB
fake_thanosruler.go 6KB
fake_prometheus.go 6KB
fake_alertmanagerconfig.go 5KB
ingress.go 5KB
fake_servicemonitor.go 5KB
fake_prometheusrule.go 5KB
namespace_denylist.go 5KB
fake_podmonitor.go 5KB
operator_test.go 5KB
generate.go 5KB
fake_probe.go 5KB
probe.go 5KB
main.go 5KB
listwatch.go 5KB
crd.go 4KB
helpers.go 4KB
generate-crds.go 4KB
alertmanagerconfig.go 4KB
pod.go 4KB
thanosruler_test.go 4KB
main.go 4KB
prometheusrule.go 4KB
servicemonitor.go 4KB
prometheus_rule.go 4KB
merge_test.go 4KB
alertmanager.go 4KB
thanosruler.go 4KB
prometheus.go 4KB
共 354 条
- 1
- 2
- 3
- 4
cestZOE
- 粉丝: 21
- 资源: 4548
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0