This guide is about the operator process itself (the controller manager). For ClickHouse server metrics (queries, parts, replication lag), use the Prometheus endpoint in ClickHouse to scrape it separately.
Endpoints
The operator process exposes two HTTP endpoints inside the manager pod:
The metrics endpoint is off by default when running the operator binary directly (
--metrics-bind-address=0). The Helm chart turns it on with metrics.enable: true and metrics.port: 8080.
The health probe endpoint is always on; the deployment template wires /healthz and /readyz to the pod’s liveness and readiness probes on port 8081.
Operator binary flags
The relevantmanager flags (defined in cmd/main.go):
The
8443 (HTTPS) / 8080 (HTTP) convention in the flag’s help text is only a hint. The Helm chart serves HTTPS on 8080 because it sets both metrics.port: 8080 and metrics.secure: true. There is no port-based mode detection — --metrics-secure is what selects HTTPS or HTTP.Enable metrics via Helm
The chart already creates aService for the metrics port and, optionally, a ServiceMonitor for prometheus-operator.
The metrics endpoint itself is on by default (metrics.enable: true, port 8080, served over HTTPS via metrics.secure: true). The only setting you typically need to flip is prometheus.enable to have the chart create a ServiceMonitor for you:
certManager.enable: false and the ServiceMonitor will scrape with insecureSkipVerify: true, relying on bearer-token authentication only.
The full set of metrics-related defaults is:
Service/<resource-prefix>-metrics-service— exposes port8080(HTTPS whenmetrics.secure: true).ServiceMonitor/<resource-prefix>-controller-manager-metrics-monitor— whenprometheus.enable: true.ClusterRole/<resource-prefix>-metrics-reader— non-resource URL/metricswithgetverb.
Securing the metrics endpoint
Whenmetrics.secure: true the metrics server enforces TLS and Kubernetes authentication/authorization on every scrape. Scrapers must:
- Present a valid Kubernetes bearer token.
- Belong to a ServiceAccount bound to a ClusterRole granting
geton the non-resource URL/metrics.
ServiceMonitor reference
The chart renders a ServiceMonitor of this shape whenprometheus.enable: true:
tlsConfig.insecureSkipVerify: true and rely on bearer-token authentication only — the chart already does this when certManager.enable: false.
Standalone Prometheus example
If you do not use kube-prometheus-stack, the repository ships a self-contained example atexamples/prometheus_secure_metrics_scraper.yaml. It creates a ServiceAccount, the necessary RBAC, and a Prometheus CR that selects the operator’s ServiceMonitor.
Health probe endpoints
Both endpoints are registered with the same trivial ping check (
healthz.Ping from sigs.k8s.io/controller-runtime). A failing probe therefore means “the manager process is not serving HTTP on :8081” — not “controllers are unhealthy”. To detect controller-level problems, use the reconciliation metrics instead.
Both endpoints are served on port 8081 by default. They are wired to the deployment as:
unable to start manager, RBAC failures, or cache did not sync errors.
Metrics catalog
The operator does not register custom Prometheus collectors. Everything below is exposed by the underlyingcontroller-runtime and client-go libraries. The most useful series, grouped by purpose:
Reconciliation activity
The
controller label is derived by controller-runtime from the resource type registered with For(...). With the current code in internal/controller/clickhouse and internal/controller/keeper this resolves to clickhousecluster and keepercluster respectively. If you have customized the operator, verify with a one-time scrape of /metrics.
Work queue
The
name and controller labels carry the same value (the controller name).
API server traffic
Leader election
The Helm chart enables
--leader-elect by default, so this metric is present in standard Helm installs. When running the binary directly without the flag, the metric is absent.
Runtime
Standard Go process and runtime collectors —go_goroutines, go_memstats_*, process_cpu_seconds_total, process_resident_memory_bytes, etc.
Useful PromQL queries
Health overview
Backlog detection
Throttling and API pressure
Leader status (HA deployment)
Suggested alerts
Starting point for a PrometheusRule (tune thresholds for your environment):Verifying the setup
A quick end-to-end check, assuming the chart was installed inclickhouse-operator-system:
Related guides
- Installation — Helm values relevant to monitoring.
- Configuration — TLS configuration shared with the metrics server.