prometheusprometheus-operatorkube-prometheus-stack

prometheus-community/helm-charts/prometheus Helm chart in agent mode: Configuring "rule_files"


I deployed the prometheus-community/helm-charts/prometheus Helm chart in agent mode to my Kubernetes cluster. However, the prometheus-server pod is stuck in "CrashLoopBackOff" with the following error: "Error loading config (--config.file=/etc/config/prometheus.yml)" file=/etc/config/prometheus.yml err="field rule_files is not allowed in agent mode".

To work around this issue, I removed the "rule_files" field from the prometheus-server ConfigMap, and the pod started successfully. However, I'd like to configure the Helm chart in a way that avoids having to remove this field manually.

How can I set the Helm values or configuration to ensure that the "rule_files" field is not present from the beginning when deploying the Prometheus Helm chart in agent mode?

Here's my current Helm values.yaml file:

alertmanager:
  enabled: false
prometheus-pushgateway:
  enabled: false
server:
  configPath: /etc/config/prometheus.yml
  defaultFlagsOverride:
  - --enable-feature=agent
  - --config.file=/etc/config/prometheus.yml
  extraFlags:
  - web.enable-lifecycle
  global:
    evaluation_interval: 30s
    scrape_interval: 30s
    scrape_timeout: 10s
  remoteWrite:
  - basic_auth:
      password: xxxx
      username: yyyy
    url: https://my-external-prometheus.com/api/v1/write

Solution

  • I fixed this by adding the following to my values, this ensures that no rule_files are processed.

    prometheus:
      serverFiles:
        prometheus.yml:
          rule_files: []