1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-25 13:37:34 +00:00
Prometheus Operator creates/configures/manages Prometheus clusters atop Kubernetes
Find a file
2017-08-01 10:11:33 +02:00
.github github: add issue template 2017-02-24 16:43:01 +01:00
cmd Documentation: add compatibility doc 2017-08-01 10:11:33 +02:00
contrib *: bump version 2017-07-28 12:06:00 +02:00
Documentation Documentation: add compatibility doc 2017-08-01 10:11:33 +02:00
example Merge pull request from Gouthamve/crd 2017-07-28 14:14:43 +02:00
hack generate Prometheus Operator deployments with jsonnet () 2017-07-27 14:17:57 +02:00
helm Merge pull request from niclic/niclic-fix-498 2017-07-27 16:37:05 +02:00
pkg Documentation: add compatibility doc 2017-08-01 10:11:33 +02:00
scripts generate Prometheus Operator deployments with jsonnet () 2017-07-27 14:17:57 +02:00
test *: adapt to k8s.io/client-go v4.0.0-beta.0 update 2017-07-28 15:01:29 +02:00
vendor *: re-introduce k8s.io/client-go/util/workqueue 2017-07-28 15:08:46 +02:00
.gitignore Ignore Helm requirements.lock files 2017-05-30 13:56:09 -07:00
.header *: add license header and script to ensure it 2016-11-01 16:59:36 +01:00
.promu.yml Build system: Introduce promu to prometheus-operator 2017-01-30 19:22:56 +01:00
bundle.yaml Merge pull request from Gouthamve/crd 2017-07-28 14:14:43 +02:00
CHANGELOG.md CHANGELOG: add v0.11.1 entry 2017-07-28 12:01:36 +02:00
code-of-conduct.md Add liecense, CoC, etc. 2016-11-01 14:37:27 +01:00
CONTRIBUTING.md Add liecense, CoC, etc. 2016-11-01 14:37:27 +01:00
DCO Add liecense, CoC, etc. 2016-11-01 14:37:27 +01:00
Dockerfile separate build the binary and container 2017-01-31 15:16:09 +01:00
Jenkinsfile test: Bring up k8s cluster via tectonic-installer 2017-07-15 11:31:34 +02:00
LICENSE Add liecense, CoC, etc. 2016-11-01 14:37:27 +01:00
Makefile Documentation: add compatibility doc 2017-08-01 10:11:33 +02:00
NOTICE Add liecense, CoC, etc. 2016-11-01 14:37:27 +01:00
README.md Add GoReportCard badge 2017-06-22 08:38:24 -04:00
ROADMAP.md Fix spelling 2017-02-14 17:34:26 +06:00
VERSION *: bump version 2017-07-28 12:06:00 +02:00

Prometheus Operator

Build Status Go Report Card

Project status: alpha Not all planned features are completed. The API, spec, status and other user facing objects are subject to change. We do not support backward-compatibility for the alpha releases.

The Prometheus Operator for Kubernetes provides easy monitoring definitions for Kubernetes services 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 based on familiar Kubernetes label queries; no need to learn a Prometheus specific configuration language.

For an introduction to the Prometheus Operator, see the initial blog post.

Documentation is hosted on coreos.com

The current project roadmap can be found here.

Prometheus Operator vs. kube-prometheus

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

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

Prerequisites

Version >=0.2.0 of the Prometheus Operator requires a Kubernetes cluster of version >=1.5.0. If you are just starting out with the Prometheus Operator, it is highly recommended to use the latest version.

If you have previously used pre-1.5.0 releases of Kubernetes with the 0.1.0 version of the Prometheus Operator, see the migration section.

Migration

The PetSet was deprecated in the 1.5.0 release of Kubernetes in favor of the StatefulSet. As the Prometheus Operator used the PetSet in version 0.1.0, those need to be migrated as we upgrade our Kubernetes cluster as well as the Prometheus Operator.

First the Prometheus Operator needs to be shut down. Once shut down, retrieve the PetSets that were generated by it. You can do so simply by finding all Prometheus and Alertmanager objects created:

kubectl get prometheuses --all-namespaces
kubectl get alertmanagers --all-namespaces

For each Prometheus and Alertmanager object, a respective PetSet with the same name was created in the same namespace. Those PetSets need to be migrated according to the official migration documentation.

Once migrated and on Kubernetes version >=1.5.0, you can start the Prometheus Operator of version >=0.2.0, and the StatefulSet created in the migration will from now on be managed by the Prometheus Operator.

Third party resources

The Operator acts on the following third party resources (TPRs):

  • 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 groups of services should be monitored. The Operator automatically generates Prometheus scrape configuration based on the definition.

  • 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 TPRs introduced by the Prometheus Operator have a look at 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:

make
hack/run-external.sh <kubectl cluster name>

Removal

To remove the operator and Prometheus, first delete any third party resources you created in each namespace. The operator 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,alertmanager
done

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 third party resources. 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-operated
done

kubectl delete --ignore-not-found thirdpartyresource \
  prometheus.monitoring.coreos.com \
  service-monitor.monitoring.coreos.com \
  alertmanager.monitoring.coreos.com

The Prometheus Operator collects anonymous usage statistics to help us learning how the software is being used and how we can improve it. To disable collection, run the Operator with the flag -analytics=false