Configuration

April 16, 2026 · View on GitHub

Configured via environment variables only — no flags. Defaults match deploy/kustomize/base/deployment.yaml and cmd/kuberhealthy/config.go.

Controller environment variables

VariableDescriptionDefault
KH_LISTEN_ADDRESSHTTP listen address for the main web server:8080
KH_LISTEN_ADDRESS_TLSHTTPS listen address when TLS is enabled:443
KH_LOG_LEVELLog level (trace, debug, info, warn, error, fatal, panic)info
KH_MAX_JOB_AGELegacy setting for job cleanup (unused in v3). Go duration syntaxunset
KH_MAX_CHECK_POD_AGEMaximum age for check pods before cleanup, regardless of phase. Empty disables age-based cleanupunset
KH_MAX_COMPLETED_POD_COUNTMaximum number of completed check pods to retain1
KH_MAX_ERROR_POD_COUNTNumber of failed check pods to retain for debugging2
KH_ERROR_POD_RETENTION_TIMEDuration to retain failed check pods when count-based retention is not reached36h
KH_PROM_SUPPRESS_ERROR_LABELWhen true, omit the error label on Prometheus metricsfalse
KH_PROM_ERROR_LABEL_MAX_LENGTHMaximum length of the Prometheus error label; 0 disables truncation0
KH_PROM_LABEL_ALLOWLISTComma-separated list of extra label keys to include (e.g. severity,category)severity,category
KH_PROM_LABEL_DENYLISTComma-separated list of extra label keys to exclude from metricsunset
KH_PROM_LABEL_VALUE_MAX_LENGTHMaximum length of extra label values; 0 disables truncation256
KH_TARGET_NAMESPACENamespace to watch for HealthCheck resources; empty means all namespaces``
KH_DEFAULT_RUN_INTERVALDefault run interval for checks that omit spec.runInterval10m
KH_CHECK_REPORT_URLBase URL used by checker pods to report results; /check is appended automatically. Do not include /checkhttp://kuberhealthy.<namespace>.svc.cluster.local
KH_TERMINATION_GRACE_PERIODTime to wait for clean shutdown before forced exit5m
KH_DEFAULT_CHECK_TIMEOUTDefault timeout for checks that omit spec.timeout30s
KH_DEFAULT_NAMESPACEFallback namespace when a check does not specify oneunset
POD_NAMESPACENamespace of the running controller pod. Typically injected via the Downward API<pod namespace>
POD_NAMEName of the running controller pod. Used for logging; hostname used if unset<pod name>
KH_TLS_CERT_FILEPath to the TLS certificate file. If set with KH_TLS_KEY_FILE, an HTTPS listener is startedunset
KH_TLS_KEY_FILEPath to the TLS private key file. If set with KH_TLS_CERT_FILE, an HTTPS listener is startedunset
KH_LEADER_ELECTION_ENABLEDEnable Lease-based leader election for check scheduling and reapingtrue
KH_LEADER_ELECTION_NAMELease name used for leader electionkuberhealthy-controller
KH_LEADER_ELECTION_NAMESPACENamespace that stores the Lease object<POD_NAMESPACE>
KH_LEADER_ELECTION_LEASE_DURATIONLease duration for leader election15s
KH_LEADER_ELECTION_RENEW_DEADLINERenewal deadline for leader election10s
KH_LEADER_ELECTION_RETRY_PERIODRetry period for leader election2s

Leader election requires the controller service account to have get, list, watch, create, update, and patch access to coordination.k8s.io leases in the configured lease namespace.

RBAC requirements

The controller ServiceAccount needs the ClusterRole permissions defined in deploy/kustomize/base/clusterrole.yaml:

  • kuberhealthy.github.io healthchecks (including status and finalizers)
  • Core pods, pods/log, and events
  • coordination.k8s.io leases for leader election

Checker pod environment variables

These are injected into every checker pod by the controller. They are not configured on the controller deployment.

VariableDescription
KH_REPORTING_URLFull URL for reporting check results
KH_CHECK_RUN_DEADLINEUnix timestamp deadline derived from the check timeout
KH_RUN_UUIDUnique run identifier — send as the kh-run-uuid header
KH_POD_NAMESPACENamespace the checker pod is running in

See CHECK_CREATION.md for how to use them.