nats-io / k8s

NATS on Kubernetes with Helm Charts
Apache License 2.0
446 stars 302 forks source link

Prometheus Exporter Port Name #826

Closed rustik666 closed 10 months ago

rustik666 commented 10 months ago

What this PR does / why we need it

In this PR we add ability to rewrite Prometheus exporter container port name to be able to avoid hardcoded prom-metrics value.

Which issue this PR fixes

For our particular case, we use internal rule to name all ports targets of ClusterPodMonitor as metrics with NetworkPolicy where we allow gmp-system to collect metrics from named port.

caleblloyd commented 10 months ago

Already possible with:

promExporter:
  enabled: true
  patch:
  - op: replace
    path: /ports/0/name
    value: your-port-name

  # if you are also using the pod monitor, do this too:
  podMonitor:
    enabled: true
    patch:
    - op: replace
      path: /spec/podMetricsEndpoints/0/port
      value: your-port-name
rustik666 commented 9 months ago

Already possible with:

promExporter:
  enabled: true
  patch:
  - op: replace
    path: /ports/0/name
    value: your-port-name

  # if you are also using the pod monitor, do this too:
  podMonitor:
    enabled: true
    patch:
    - op: replace
      path: /spec/podMetricsEndpoints/0/port
      value: your-port-name

@caleblloyd thank you very much!