• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

prometheus-operator: The Prometheus Operator for Kubernetes provides easy monito ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

prometheus-operator

开源软件地址:

https://gitee.com/AliyunContainerService/prometheus-operator

开源软件介绍:

Prometheus Operator

Build StatusGo Report Card

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.

The Prometheus Operator for Kubernetes provides easy monitoring definitions for Kubernetesservices and deployment and management of Prometheus instances.

Once installed, the Prometheus Operator provides the following features:

  • Create/Destroy: Easily launch a Prometheus instance for your Kubernetes namespace,a specific application or team easily using the Operator.

  • Simple Configuration: Configure the fundamentals of Prometheus like versions, persistence,retention policies, and replicas from a native Kubernetes resource.

  • Target Services via Labels: Automatically generate monitoring target configurations basedon familiar Kubernetes label queries; no need to learn a Prometheus specific configuration language.

For an introduction to the Prometheus Operator, see the initial blogpost.

Prometheus Operator vs. kube-prometheus

The Prometheus Operator makes the Prometheus configuration Kubernetes nativeand manages and operates Prometheus and Alertmanager clusters. It is a piece ofthe puzzle regarding full end-to-end monitoring.

kube-prometheus combines the Prometheus Operatorwith a collection of manifests to help getting started with monitoringKubernetes itself and applications running on top of it.

Prerequisites

Version >=0.18.0 of the Prometheus Operator requires a Kubernetescluster of version >=1.8.0. If you are just starting out with thePrometheus 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

The Operator acts on the following custom resource definitions (CRDs):

  • Prometheus, which defines a desired Prometheus deployment.The Operator ensures at all times that a deployment matching the resource definition is running.

  • ServiceMonitor, which declaratively specifies how groupsof services should be monitored. The Operator automatically generates Prometheus scrape configurationbased on the definition.

  • PrometheusRule, which defines a desired Prometheus rule file, which canbe loaded by a Prometheus instance containing Prometheus alerting andrecording rules.

  • Alertmanager, which defines a desired Alertmanager deployment.The Operator ensures at all times that a deployment matching the resource definition is running.

To learn more about the CRDs introduced by the Prometheus Operator have a lookat the design doc.

Installation

Install the Operator inside a cluster by running the following command:

kubectl apply -f bundle.yaml

Note: make sure to adapt the namespace in the ClusterRoleBinding if deploying in another namespace than the default namespace.

To run the Operator outside of a cluster:

makehack/run-external.sh <kubectl cluster name>

Removal

To remove the operator and Prometheus, first delete any custom resources you created in each namespace. Theoperator will automatically shut down and remove Prometheus and Alertmanager pods, and associated configmaps.

for n in $(kubectl get namespaces -o jsonpath={..metadata.name}); do  kubectl delete --all --namespace=$n prometheus,servicemonitor,alertmanagerdone

After a couple of minutes you can go ahead and remove the operator itself.

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.

for n in $(kubectl get namespaces -o jsonpath={..metadata.name}); do  kubectl delete --ignore-not-found --namespace=$n service prometheus-operated alertmanager-operateddonekubectl delete --ignore-not-found customresourcedefinitions \  prometheuses.monitoring.coreos.com \  servicemonitors.monitoring.coreos.com \  alertmanagers.monitoring.coreos.com

Development

Prerequisites

  • golang environment
  • docker (used for creating container images, etc.)
  • minikube (optional)

Testing

Ensure that you're running tests in the following path:$GOPATH/src/github.com/coreos/prometheus-operator as tests expect paths tomatch. If you're working from a fork, just add the forked repo as a remote andpull against your local coreos checkout before running tests.

Running unit tests:

make test-unit

Running end-to-end tests on local minikube cluster:

  1. minikube start --kubernetes-version=v1.10.0 --memory=4096 --extra-config=apiserver.Authorization.Mode=RBAC
  2. eval $(minikube docker-env) && make image - build Prometheus Operatordocker image on minikube's docker
  3. make test-e2e

Contributing

Many files (documentation, manifests, ...) in this repository areauto-generated. E.g. bundle.yaml originates from the Jsonnet files in/jsonnet/prometheus-operator. Before proposing a pull request:

  1. Commit your changes.
  2. Run make generate-in-docker.
  3. Commit the generated changes.

Security

If you find a security vulnerability related to the Prometheus Operator, pleasedo not report it by opening a GitHub issue, but instead please send an e-mail tothe maintainers of the project found in the OWNERS file.


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap