Skip to content

[FEATURE] Helm Chart: Add support for enabling metrics endpoint and optional ServiceMonitor #1369

@Daniel-Vaz

Description

@Daniel-Vaz

📋 Prerequisites

📝 Feature Summary

Add Helm values to easily enable the controller metrics endpoint and optionally deploy a Prometheus Operator ServiceMonitor.

❓ Problem Statement / Motivation

The kagent controller already supports exposing a metrics endpoint via the flags:

  • --metrics-bind-address
  • --metrics-secure

These can also be configured via environment variables, for example:

export METRICS_BIND_ADDRESS=":9093"
export METRICS_SECURE="false"

However, the current Helm chart does not provide a simple, documented way to enable and expose this metrics endpoint.

Even if we manually inject environment variables through values like:

controller:
  env:
    - name: "METRICS_BIND_ADDRESS"
      value: ":9093"
    - name: "METRICS_SECURE"
      value: "false"

This is still incomplete because:

  1. The Helm chart does not automatically expose the metrics port in the controller Service.
  2. Users must manually create or modify a Kubernetes Service to reference the new port.
  3. Users must manually create a ServiceMonitor (when using Prometheus Operator) to scrape the endpoint.
  4. There is no single, cohesive way to “enable metrics” through values.yaml.

This makes observability setup more complex than necessary.

💡 Proposed Solution

Introduce Helm values for metrics configuration and optional Prometheus Operator integration.

For example:

metrics:
  enabled: true
  bindAddress: ":9093"
  secure: false

  service:
    enabled: true
    port: 9093
    type: ClusterIP

  serviceMonitor:
    enabled: true
    interval: 60s
    scrapeTimeout: 10s
    labels: {}

🔄 Alternatives Considered

No response

🎯 Affected Service(s)

Controller Service

📚 Additional Context

Many Kubernetes projects provide a built-in metrics and serviceMonitor configuration block in their Helm charts. Adding similar support to kagent would:

  1. Improve user experience
  2. Reduce configuration drift
  3. Encourage consistent observability setups
  4. Make kagent easier to integrate into Prometheus-based monitoring stacks

🙋 Are you willing to contribute?

  • I am willing to submit a PR for this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions