Configuration

April 16, 2026 · View on GitHub

Environment variables only — no command-line flags.

Environment Variables

VariableDescriptionDefault
KH_LISTEN_ADDRESSAddress for the web server:8080
KH_LISTEN_ADDRESS_TLSAddress for the HTTPS listener 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)unset
KH_MAX_CHECK_POD_AGEMaximum age for check pods before cleanupunset
KH_MAX_COMPLETED_POD_COUNTNumber of completed pods to retain (0 deletes all completed pods)1
KH_MAX_ERROR_POD_COUNTNumber of errored pods to retain for debugging2
KH_ERROR_POD_RETENTION_TIMEDuration to retain failed pods (Go duration syntax)36h
POD_NAMESPACENamespace Kuberhealthy runs in<pod namespace>
KH_PROM_SUPPRESS_ERROR_LABELOmit error label in Prometheus metricsfalse
KH_PROM_ERROR_LABEL_MAX_LENGTHMaximum length for Prometheus error label0
KH_PROM_LABEL_ALLOWLISTComma-separated list of extra label keys to include (for example severity,category)severity,category
KH_PROM_LABEL_DENYLISTComma-separated list of extra label keys to excludeunset
KH_PROM_LABEL_VALUE_MAX_LENGTHMaximum length for extra label values256
KH_TARGET_NAMESPACENamespace Kuberhealthy operates in (blank for all)``
KH_DEFAULT_RUN_INTERVALDefault check run interval10m
KH_CHECK_REPORT_URLBase URL used for check reports; /check is appended automaticallyhttp://kuberhealthy.<namespace>.svc.cluster.local
KH_TERMINATION_GRACE_PERIODShutdown grace period5m
KH_DEFAULT_CHECK_TIMEOUTDefault timeout for checks30s
KH_DEFAULT_NAMESPACEFallback namespace if detection failsunset
KH_LEADER_ELECTION_ENABLEDEnable Lease-based leader election for check schedulingtrue
KH_LEADER_ELECTION_NAMELease name used for leader electionkuberhealthy-controller
KH_LEADER_ELECTION_NAMESPACENamespace that stores the Lease<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
POD_NAMEName of the running controller pod<pod name>
KH_TLS_CERT_FILETLS certificate path for HTTPS listenerunset
KH_TLS_KEY_FILETLS private key path for HTTPS listenerunset

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

TLS and HTTPS

Set KH_TLS_CERT_FILE and KH_TLS_KEY_FILE to enable the HTTPS listener. The HTTP listener remains active. You must also expose port 443 on the Service or ingress, and mount the certificate/key into the pod. See DEPLOYING_KUBERHEALTHY.MD for an example patch.

Checker pod environment variables

Checker pods receive additional variables injected by the controller. These are not configured on the controller deployment:

  • KH_REPORTING_URL
  • KH_CHECK_RUN_DEADLINE
  • KH_RUN_UUID
  • KH_POD_NAMESPACE

See CHECK_CREATION.md for how to use them.