prometheus-operator
Provides easy monitoring definitions for Kubernetes services, and deployment and management of Prometheus instances.
About this chart
prometheus-operator
Installs prometheus-operator to create/configure/manage Prometheus clusters atop Kubernetes. This chart includes multiple components and is suitable for a variety of use-cases.
The default installation is intended to suit monitoring a kubernetes cluster the chart is deployed onto. It closely matches the kube-prometheus project.
- prometheus-operator
- prometheus
- alertmanager
- node-exporter
- kube-state-metrics
- grafana
- service monitors to scrape internal kubernetes components
- kube-apiserver
- kube-scheduler
- kube-controller-manager
- etcd
- kube-dns/coredns With the installation, the chart also includes dashboards and alerts.
The same chart can be used to run multiple prometheus instances in the same cluster if required. To achieve this, the other components need to be disabled - it is necessary to run only one instance of prometheus-operator and a pair of alertmanager pods for an HA configuration.
TL;DR;
$ helm install stable/prometheus-operator
Introduction
This chart bootstraps a prometheus-operator deployment on a Kubernetes cluster using the Helm package manager. The chart can be installed multiple times to create separate Prometheus instances managed by Prometheus Operator.
Prerequisites
- Kubernetes 1.10+ with Beta APIs
- Helm 2.10+ (For a workaround using an earlier version see below)
Installing the Chart
To install the chart with the release name my-release:
$ helm install --name my-release stable/prometheus-operator
The command deploys prometheus-operator on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.
The default installation includes Prometheus Operator, Alertmanager, Grafana, and configuration for scraping Kubernetes infrastructure.
Uninstalling the Chart
To uninstall/delete the my-release deployment:
$ helm delete my-release
The command removes all the Kubernetes components associated with the chart and deletes the release.
CRDs created by this chart are not removed by default and should be manually cleaned up:
kubectl delete crd prometheuses.monitoring.coreos.com
kubectl delete crd prometheusrules.monitoring.coreos.com
kubectl delete crd servicemonitors.monitoring.coreos.com
kubectl delete crd podmonitors.monitoring.coreos.com
kubectl delete crd alertmanagers.monitoring.coreos.com
Work-Arounds for Known Issues
Helm fails to create CRDs
Due to a bug in helm, it is possible for the 4 CRDs that are created by this chart to fail to get fully deployed before Helm attempts to create resources that require them. This affects all versions of Helm with a potential fix pending. In order to work around this issue when installing the chart you will need to make sure all 4 CRDs exist in the cluster first and disable their previsioning by the chart:
- Create CRDs
kubectl apply -f https://raw.githubusercontent.com/coreos/prometheus-operator/master/example/prometheus-operator-crd/alertmanager.crd.yaml
kubectl apply -f https://raw.githubusercontent.com/coreos/prometheus-operator/master/example/prometheus-operator-crd/prometheus.crd.yaml
kubectl apply -f https://raw.githubusercontent.com/coreos/prometheus-operator/master/example/prometheus-operator-crd/prometheusrule.crd.yaml
kubectl apply -f https://raw.githubusercontent.com/coreos/prometheus-operator/master/example/prometheus-operator-crd/servicemonitor.crd.yaml
kubectl apply -f https://raw.githubusercontent.com/coreos/prometheus-operator/master/example/prometheus-operator-crd/podmonitor.crd.yaml
-
Wait for CRDs to be created, which should only take a few seconds
-
Install the chart, but disable the CRD provisioning by setting
prometheusOperator.createCustomResource=false
$ helm install --name my-release stable/prometheus-operator --set prometheusOperator.createCustomResource=false
Helm <2.10 workaround
The crd-install hook is required to deploy the prometheus operator CRDs before they are used. If you are forced to use an earlier version of Helm you can work around this requirement as follows:
- Install prometheus-operator by itself, disabling everything but the prometheus-operator component, and also setting
prometheusOperator.serviceMonitor.selfMonitor=false - Install all the other components, and configure
prometheus.additionalServiceMonitorsto scrape the prometheus-operator service.
Configuration
The following tables list the configurable parameters of the prometheus-operator chart and their default values.
General
| Parameter | Description | Default |
|---|---|---|
nameOverride | Provide a name in place of prometheus-operator | "" |
fullNameOverride | Provide a name to substitute for the full names of resources | "" |
commonLabels | Labels to apply to all resources | [] |
defaultRules.create | Create default rules for monitoring the cluster | true |
defaultRules.rules.alertmanager | Create default rules for Alert Manager | true |
defaultRules.rules.etcd | Create default rules for ETCD | true |
defaultRules.rules.general | Create General default rules | true |
defaultRules.rules.k8s | Create K8S default rules | true |
defaultRules.rules.kubeApiserver | Create Api Server default rules | true |
defaultRules.rules.kubePrometheusNodeAlerting | Create Node Alerting default rules | true |
defaultRules.rules.kubePrometheusNodeRecording | Create Node Recording default rules | true |
defaultRules.rules.kubeScheduler | Create Kubernetes Scheduler default rules | true |
defaultRules.rules.kubernetesAbsent | Create Kubernetes Absent (example API Server down) default rules | true |
defaultRules.rules.kubernetesApps | Create Kubernetes Apps default rules | true |
defaultRules.rules.kubernetesResources | Create Kubernetes Resources default rules | true |
defaultRules.rules.kubernetesStorage | Create Kubernetes Storage default rules | true |
defaultRules.rules.kubernetesSystem | Create Kubernetes System default rules | true |
defaultRules.rules.node | Create Node default rules | true |
defaultRules.rules.PrometheusOperator | Create Prometheus Operator default rules | true |
defaultRules.rules.prometheus | Create Prometheus default rules | true |
defaultRules.labels | Labels for default rules for monitoring the cluster | {} |
defaultRules.annotations | Annotations for default rules for monitoring the cluster | {} |
additionalPrometheusRules | DEPRECATED Will be removed in a future release. Please use additionalPrometheusRulesMap instead. List of prometheusRule objects to create. See https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusrulespec. | [] |
additionalPrometheusRulesMap | Map of prometheusRule objects to create with the key used as the name of the rule spec. If defined, this will take precedence over additionalPrometheusRules. See https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusrulespec. | nil |
global.rbac.create | Create RBAC resources | true |
global.rbac.pspEnabled | Create pod security policy resources | true |
global.imagePullSecrets | Reference to one or more secrets to be used when pulling images | [] |
Prometheus Operator
| Parameter | Description | Default |
|---|---|---|
prometheusOperator.enabled | Deploy Prometheus Operator. Only one of these should be deployed into the cluster | true |
prometheusOperator.serviceAccount.create | Create a serviceaccount for the operator | true |
prometheusOperator.serviceAccount.name | Operator serviceAccount name | "" |
prometheusOperator.logFormat | Operator log output formatting | "logfmt" |
prometheusOperator.logLevel | Operator log level. Possible values: "all", "debug", "info", "warn", "error", "none" | "info" |
prometheusOperator.createCustomResource | Create CRDs. Required if deploying anything besides the operator itself as part of the release. The operator will create / update these on startup. If your Helm version < 2.10 you will have to either create the CRDs first or deploy the operator first, then the rest of the resources | true |
prometheusOperator.crdApiGroup | Specify the API Group for the CustomResourceDefinitions | monitoring.coreos.com |
prometheusOperator.cleanupCustomResourceBeforeInstall | Remove CRDs before running the crd-install hook on changes. | false |
prometheusOperator.cleanupCustomResource | Attempt to delete CRDs when the release is removed. This option may be useful while testing but is not recommended, as deleting the CRD definition will delete resources and prevent the operator from being able to clean up resources that it manages | false |
prometheusOperator.podLabels | Labels to add to the operator pod | {} |
prometheusOperator.podAnnotations | Annotations to add to the operator pod | {} |
prometheusOperator.priorityClassName | Name of Priority Class to assign pods | nil |
prometheusOperator.kubeletService.enabled | If true, the operator will create and maintain a service for scraping kubelets | true |
prometheusOperator.kubeletService.namespace | Namespace to deploy kubelet service | kube-system |
prometheusOperator.serviceMonitor.selfMonitor | Enable monitoring of prometheus operator | true |
prometheusOperator.serviceMonitor.interval | Scrape interval. If not set, the Prometheus default scrape interval is used | nil |
prometheusOperator.serviceMonitor.metricRelabelings | The metric_relabel_configs for scraping the operator instance. | `` |
prometheusOperator.serviceMonitor.relabelings | The relabel_configs for scraping the operator instance. | `` |
prometheusOperator.service.type | Prometheus operator service type | ClusterIP |
prometheusOperator.service.clusterIP | Prometheus operator service clusterIP IP | "" |
prometheusOperator.service.nodePort | Port to expose prometheus operator service on each node | 30080 |
prometheusOperator.service.annotations | Annotations to be added to the prometheus operator service | {} |
prometheusOperator.service.labels | Prometheus Operator Service Labels | {} |
prometheusOperator.service.externalIPs | List of IP addresses at which the Prometheus Operator server service is available | [] |
prometheusOperator.service.loadBalancerIP | Prometheus Operator Loadbalancer IP | "" |
prometheusOperator.service.loadBalancerSourceRanges | Prometheus Operator Load Balancer Source Ranges | [] |
prometheusOperator.resources | Resource limits for prometheus operator | {} |
prometheusOperator.securityContext | SecurityContext for prometheus operator | {"runAsNonRoot": true, "runAsUser": 65534} |
prometheusOperator.nodeSelector | Prometheus operator node selector https://kubernetes.io/docs/user-guide/node-selection/ | {} |
prometheusOperator.tolerations | Tolerations for use with node taints https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ | [] |
prometheusOperator.affinity | Assign custom affinity rules to the prometheus operator https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ | {} |
prometheusOperator.image.repository | Repository for prometheus operator image | quay.io/coreos/prometheus-operator |
prometheusOperator.image.tag | Tag for prometheus operator image | v0.31.1 |
prometheusOperator.image.pullPolicy | Pull policy for prometheus operator image | IfNotPresent |
prometheusOperator.configmapReloadImage.repository | Repository for configmapReload image | quay.io/coreos/configmap-reload |
prometheusOperator.configmapReloadImage.tag | Tag for configmapReload image | v0.0.1 |
prometheusOperator.prometheusConfigReloaderImage.repository | Repository for config-reloader image | quay.io/coreos/prometheus-config-reloader |
prometheusOperator.prometheusConfigReloaderImage.tag | Tag for config-reloader image | v0.31.1 |
prometheusOperator.configReloaderCpu | Set the prometheus config reloader side-car CPU limit. If unset, uses the prometheus-operator project default | nil |
prometheusOperator.configReloaderMemory | Set the prometheus config reloader side-car memory limit. If unset, uses the prometheus-operator project default | nil |
prometheusOperator.hyperkubeImage.repository | Repository for hyperkube image used to perform maintenance tasks | k8s.gcr.io/hyperkube |
prometheusOperator.hyperkubeImage.tag | Tag for hyperkube image used to perform maintenance tasks | v1.12.1 |
prometheusOperator.hyperkubeImage.repository | Image pull policy for hyperkube image used to perform maintenance tasks | IfNotPresent |
Prometheus
| Parameter | Description | Default |
|---|---|---|
prometheus.enabled | Deploy prometheus | true |
prometheus.serviceMonitor.selfMonitor | Create a serviceMonitor to automatically monitor the prometheus instance | true |
prometheus.serviceMonitor.interval | Scrape interval. If not set, the Prometheus default scrape interval is used | nil |
prometheus.serviceMonitor.metricRelabelings | The `metric_relabel_c |
Deploy prometheus-operator with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has prometheus-operator on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartprometheus-operator is pinned at v5.15.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply