Problem
It seems there is no way to simultaneously support mTLS authenticated /metrics and HTTP/S (not mTLS) /health endpoints.
The /health endpoint shares a listener with the /metrics endpoint. Using the -–client-cert-auth option thus subjects both endpoints to mTLS authentication. However, the use cases for metrics and health probing could be quite different. Metrics might tend to be secured, while health endpoints may be subject to less strict authentication requirements.
The health check docs seem to acknowledge this problem area, but in a way that's slightly confusing to me:
Since v3.3.0, in addition to responding to the /metrics endpoint, any locations specified by --listen-metrics-urls will also respond to the /health endpoint. This can be useful if the standard endpoint is configured with mutual (client) TLS authentication, but a load balancer or monitoring service still needs access to the health check.
The health endpoint seems like the practical choice for a Kubernetes HTTP health probe, but the probe APIs don't support mTLS.
This leaves users left implementing health checks through something like exec probes, which can add unnecessary complexity and inefficiency.
Solutions
One solution might be to decouple the health and metrics endpoint listeners. Then health authentication must be addressed in some way to provide the needed flexibility. For example:
- For the health listener, honor global the global TLS configuration by default (for compatibility with today's behavior), but provide a new flag to allow control over health endpoint client certificate auth (e.g.
--health-client-cert-auth=false).
- For the health listener, introduce a complete parallel set of TLS configurations to allow granular control of the health endpoint independent of metrics.
Notes
Of course, if I've missed something and my core claim is invalid:
It seems there is no way to simultaneously support mTLS authenticated /metrics and HTTP/S (not mTLS) /health endpoints.
I'd love to understand how to implement this without any changes.
Problem
It seems there is no way to simultaneously support mTLS authenticated /metrics and HTTP/S (not mTLS) /health endpoints.
The /health endpoint shares a listener with the /metrics endpoint. Using the
-–client-cert-authoption thus subjects both endpoints to mTLS authentication. However, the use cases for metrics and health probing could be quite different. Metrics might tend to be secured, while health endpoints may be subject to less strict authentication requirements.The health check docs seem to acknowledge this problem area, but in a way that's slightly confusing to me:
The health endpoint seems like the practical choice for a Kubernetes HTTP health probe, but the probe APIs don't support mTLS.
This leaves users left implementing health checks through something like
execprobes, which can add unnecessary complexity and inefficiency.Solutions
One solution might be to decouple the health and metrics endpoint listeners. Then health authentication must be addressed in some way to provide the needed flexibility. For example:
--health-client-cert-auth=false).Notes
Of course, if I've missed something and my core claim is invalid:
I'd love to understand how to implement this without any changes.