prometheus

by joaquinito2051

Helm chartv31.0.0App v3.16.0Apache-2.0

Prometheus is a monitoring system and time series database.

About this chart

Prometheus

Prometheus, a Cloud Native Computing Foundation project, is a systems and service monitoring system. It collects metrics from configured targets at given intervals, evaluates rule expressions, displays the results, and can trigger alerts if some condition is observed to be true.

This chart bootstraps a Prometheus deployment on a Kubernetes cluster using the Helm package manager.

Prerequisites

  • Kubernetes 1.19+
  • Helm 3.7+

Usage

The chart is distributed as an OCI Artifact as well as via a traditional Helm Repository.

  • OCI Artifact: oci://ghcr.io/prometheus-community/charts/prometheus
  • Helm Repository: https://prometheus-community.github.io/helm-charts with chart prometheus

The installation instructions use the OCI registry. Refer to the helm repo command documentation for information on installing charts via the traditional repository.

Install Chart

Starting with version 16.0, the Prometheus chart requires Helm 3.7+ in order to install successfully. Please check your helm release before installation.

helm install [RELEASE_NAME] oci://ghcr.io/prometheus-community/charts/prometheus

See configuration below.

See helm install for command documentation.

Dependencies

By default this chart installs additional, dependent charts:

To disable the dependency during installation, set alertmanager.enabled, kube-state-metrics.enabled, prometheus-node-exporter.enabled and prometheus-pushgateway.enabled to false.

See helm dependency for command documentation.

Uninstall Chart

helm uninstall [RELEASE_NAME]

This removes all the Kubernetes components associated with the chart and deletes the release.

See helm uninstall for command documentation.

Updating values.schema.json

A values.schema.json file has been added to validate chart values. When values.yaml file has a structure change (i.e. add a new field, change value type, etc.), modify values.schema.json file manually or run helm schema-gen values.yaml > values.schema.json to ensure the schema is aligned with the latest values. Refer to helm plugin helm-schema-gen for plugin installation instructions.

Upgrading Chart

helm upgrade [RELEASE_NAME] oci://ghcr.io/prometheus-community/charts/prometheus --install

See helm upgrade for command documentation.

To 31.0

The Prometheus server Pod now meets the restricted Pod Security Standard by default:

  • server.securityContext adds seccompProfile.type: RuntimeDefault.
  • server.containerSecurityContext and configmapReload.prometheus.containerSecurityContext now default to allowPrivilegeEscalation: false, capabilities.drop: [ALL] and readOnlyRootFilesystem: true.

Prometheus writes only to its data directory, which the chart mounts at server.persistentVolume.mountPath (an emptyDir when persistence is disabled). If you moved the storage path with server.storagePath, or dropped --storage.tsdb.path / --storage.agent.path through server.defaultFlagsOverride, make sure it points to a mounted volume, otherwise Prometheus may not be able to write to it. Containers from server.sidecarContainers and server.extraInitContainers keep the security context you give them.

Because Helm merges maps, setting containerSecurityContext: {} keeps the new defaults. To change a single setting, override that field:

server:
  containerSecurityContext:
    readOnlyRootFilesystem: false

To render no container security context at all, set it to null with -f or --set on install or upgrade:

server:
  containerSecurityContext: null
configmapReload:
  prometheus:
    containerSecurityContext: null

When this chart is a dependency of another chart, a null in the parent chart's values.yaml removes the defaults with Helm 3.17.1 or later (helm/helm#12879) and Helm 4.0 to 4.1. Older Helm 3 releases and Helm 4.2 or later (helm/helm#32132) keep them; there, override the individual fields or pass the null with -f/--set.

To 30.0

The default filesystem collector arguments in the prometheus-node-exporter subchart moved from extraArgs to the new defaultArgs value. Field extraArgs is now empty, so extra arguments you add no longer replace the defaults.

If you previously copied the defaults into your own extraArgs, remove them before upgrading as Node exporter refuses a flag given twice and would not start. To change or drop a default, override defaultArgs instead.

To 29.0

Starting with version 29.0, the default kubernetes_sd_configs roles for several scrape configurations have been migrated from endpoints to endpointslice due to the deprecation of the former in Kubernetes release 1.33.

Affected scrape configurations in scrapeConfigs:

  • kubernetes-api-servers
  • kubernetes-service-endpoints
  • kubernetes-service-endpoints-slow

Users who currently apply custom relabelings with the endpoints labels should adjust their configuration for the endpointslice labels before upgrading.

To 28.0

Scrape configs previously defined in field serverFiles."prometheus.yml".scrape_configs (array) have been moved in the new field scrapeConfigs (map). The contents of the scrape configs have not changed.

Each scrape config can be disabled by setting enabled to false, each key becomes the default value of job_name. Further scrape configs can be inserted as new keys whereby these get enabled by default. A scrape config expects native Prometheus' configuration.

Field extraScrapeConfigs can still be used for additional scrape configs and is not affected by the change.

Using the new field is not mandatory, serverFiles."prometheus.yml".scrape_configs works in the same way as before but is unset by default. Users wishing to continue using this field via a custom values file should unset scrapeConfigs before upgrading:

scrapeConfigs: null

Similarly, users who wish to make use of the new field but have modified the previous default scrape configs should transfer the modifications in scrapeConfigs and remove the previous scrape configs.

Some examples:

  • Skip certificate verification for API servers (default is not to skip the verification)
scrapeConfigs:
  kubernetes-api-servers:
    tls_config:
      insecure_skip_verify: true
  • Add basic auth in the default scrape config for prometheus
scrapeConfigs:
  prometheus:
    basic_auth:
      username: "admin"
      password_file: /etc/private/auth-passwd
  • Disable scrape config kubernetes-pods-slow
scrapeConfigs:
  kubernetes-pods-slow:
    enabled: false
  • Add a new scrape config with job_name set to foo (gets enabled by default)
scrapeConfigs:
  foo:
    honor_labels: true
    kubernetes_sd_configs:
      - role: service
    relabel_configs:
      - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_probe]
        action: keep
        regex: true

To 27.0

Prometheus' configuration parameter insecure_skip_verify in scrape configs serverFiles."prometheus.yml".scrape_configs has been commented out keeping thus the default Prometheus' value. If certificate verification must be skipped, please, set the configuration parameter in your scrape configs.

To 26.0

This release changes default version of prometheus to v3.0.0, See official migration guide and release notes for more details.

To 25.0

The server.remoteRead[].url and server.remoteWrite[].url fields now support templating. Allowing for url values such as https://{{ .Release.Name }}.example.com.

Any entries in these which previously included {{ or }} must be escaped with {{ "{{" }} and {{ "}}" }} respectively. Entries which did not previously include the template-like syntax will not be affected.

To 24.0

Require Kubernetes 1.19+

Release 1.0.0 of the alertmanager replaced configmap-reload with prometheus-config-reloader. Extra command-line arguments specified via configmapReload.prometheus.extraArgs are not compatible and will break with the new prometheus-config-reloader. Please, refer to the sources in order to make the appropriate adjustment to the extra command-line arguments.

To 23.0

Release 5.0.0 of the kube-state-metrics chart introduced a separation of the image.repository value in two distinct values:

 image:
   registry: registry.k8s.io
   repository: kube-state-metrics/kube-state-metrics

If a custom values file or CLI flags set kube-state.metrics.image.repository, please, set the new values accordingly.

If you are upgrading prometheus-pushgateway with the chart and prometheus-pushgateway has been deployed as a statefulset with a persistent volume, the statefulset must be deleted before upgrading the chart, e.g.:

kubectl delete sts -l app.kubernetes.io/name=prometheus-pushgateway -n monitoring --cascade=orphan

Users are advised to review changes in the corresponding chart releases before upgrading.

To 22.0

The app.kubernetes.io/version label has been removed from the pod selector.

Therefore, you must delete the previous StatefulSet or Deployment before upgrading. Performing this operation will cause Prometheus to stop functioning until the upgrade is complete.

kubectl delete deploy,sts -l app.kubernetes.io/name=prometheus

To 21.0

The Kubernetes labels have been updated to follow Helm 3 label and annotation best practices. Specifically, labels mapping is listed below:

OLDNEW
heritageapp.kubernetes.io/managed-by
charthelm.sh/chart
[container version]app.kubernetes.io/version
appapp.kubernetes.io/name
releaseapp.kubernetes.io/instance

Therefore, depending on the way you've configured the chart, the previous StatefulSet or Deployment need to be deleted before upgrade.

If runAsStatefulSet: false (this is the default):

kubectl delete deploy -l app=prometheus

If runAsStatefulSet: true:

kubectl delete sts -l app=prometheus

After that do the actual upgrade:

helm upgrade -i prometheus prometheus-community/prometheus

To 20.0

The configmap-reload container was replaced by the prometheus-config-reloader. Extra command-line arguments specified via configmapReload.prometheus.extraArgs are not compatible and will break with the new prometheus-config-reloader, refer to the sources in order to make the appropriate adjustment to the extra command-line arguments.

To 19.0

Prometheus has been updated to version v2.40.5.

Prometheus-pushgateway was updated to version 2.0.0 which adapted Helm label and annotation best practices. See the upgrade docs of the prometheus-pushgateway chart to see what's to do, before you upgrade Prometheus!

The condition in Chart.yaml to disable kube-state-metrics has been changed from kubeStateMetrics.enabled to kube-state-metrics.enabled

The Docker image tag is used from appVersion field in Chart.yaml by default.

Unused subchart configs has been removed and subchart config is now on the bottom of the config file.

If Prometheus is used as deployment the updatestrategy has been changed to "Recreate" by default, so Helm updates work out of the box.

.Values.server.extraTemplates & .Values.server.extraObjects has been removed in favour of .Values.extraManifests, which can do the same.

.Values.server.enabled has been removed as it's useless now that all components are created by subcharts.

All files in templates/server directory has been moved to templates directory.

helm upgrade [RELEASE_NAME] prometheus-community/prometheus --version 19.0.0

To 18.0

Version 18.0.0 uses alertmanager service from the [alertmanager chart](https://github.com/pro

Deploy prometheus with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has prometheus 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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartprometheus is pinned at v31.0.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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