ingress-nginx-helm/internal/ingress/metric/collectors
Thibault Jamet 1e66a54974
Add a certificate info metric (#8253)
When the ingress controller loads certificates  (new ones or following a
secret update), it performs a series of check to ensure its validity.

In our systems, we detected a case where, when the secret object is
compromised, for example when the certificate does not match the secret
key, different pods of the ingress controller are serving a different
version of the certificate.

This behaviour is due to the cache mechanism of the ingress controller,
keeping the last known certificate in case of corruption. When this
happens, old ingress-controller pods will keep serving the old one,
while new pods, by failing to load the corrupted certificates, would
use the default certificate, causing invalid certificates for its
clients.

This generates a random error on the client side, depending on the
actual pod instance it reaches.

In order to allow detecting occurences of those situations, add a metric
to expose, for all ingress controlller pods, detailed informations of
the currently loaded certificate.

This will, for example, allow setting an alert when there is a
certificate discrepency across all ingress controller pods using a query
similar to `sum(nginx_ingress_controller_ssl_certificate_info{host="name.tld"})by(serial_number)`

This also allows to catch other exceptions loading certificates (failing
to load the certificate from the k8s API, ...

Co-authored-by: Daniel Ricart <danielricart@users.noreply.github.com>

Co-authored-by: Daniel Ricart <danielricart@users.noreply.github.com>
2022-02-24 07:08:32 -08:00
..
admission.go feature: added AdmissionController metrics (#7711) 2021-11-02 10:54:34 -07:00
admission_test.go feature: added AdmissionController metrics (#7711) 2021-11-02 10:54:34 -07:00
controller.go Add a certificate info metric (#8253) 2022-02-24 07:08:32 -08:00
controller_test.go Add a certificate info metric (#8253) 2022-02-24 07:08:32 -08:00
main.go Refactor controller metrics interface 2018-07-12 12:46:34 -04:00
nginx_status.go Migrate to structured logging (klog) 2020-09-27 18:59:57 -03:00
nginx_status_test.go fix: use exponential backoff mechanism to listen on nginx.StatusPort 2021-05-13 15:02:11 +08:00
process.go Spelling 2020-12-15 16:10:48 -05:00
process_test.go Fix race condition in metric process collector test 2019-03-04 21:54:42 +01:00
socket.go fix inconsistent-label-cardinality for prometheus metrics: nginx_ingress_controller_requests (#8225) 2022-02-13 10:33:47 -08:00
socket_test.go fix inconsistent-label-cardinality for prometheus metrics: nginx_ingress_controller_requests (#8225) 2022-02-13 10:33:47 -08:00
testutils.go Fix some typos 2018-11-05 22:10:11 +08:00