KubeUser exposes Prometheus metrics for monitoring certificate operations, user status, and controller performance.
Metrics are exposed on the controller's metrics endpoint (default: :8443/metrics with TLS).
Counter tracking total certificate rotations.
Labels:
namespace: User namespaceuser: User namestatus: Rotation status (success,failure)
Histogram tracking certificate rotation duration.
Labels:
namespace: User namespace
Buckets: 0.1, 0.5, 1, 2, 5, 10, 30 seconds
Counter tracking certificate rotation errors.
Labels:
namespace: User namespaceuser: User nameerror_type: Error category (csr_approval,atomic_flip,shadow_secret_check, etc.)
Gauge tracking total number of managed users.
Labels:
namespace: User namespacestatus: User status (active,pending,error,renewing)
Gauge tracking user sync status (1=synced, 0=pending).
Labels:
namespace: User namespaceuser: User name
Counter tracking total reconciliation attempts.
Labels:
controller: Controller name (e.g.,user)result: Reconciliation result (success,error,conflict,requeued,finalizer_added,deleted,not_found)
Notable result values:
finalizer_added: a first reconcile pass that persisted the finalizer and ended; the watch event from that write triggers the business-logic pass.conflict: a status update lost an optimistic-concurrency race with a concurrent writer and was discarded; the reconcile requeues in 5 seconds and recomputes. Sustained non-zero rates indicate another writer fighting over the same objects. These are not counted aserror.
Histogram tracking reconciliation loop duration.
Labels:
controller: Controller name
Buckets: 15 exponential buckets from 0.001s with factor 2 (0.001s → 0.002 → ... → ~16.4s)
Gauge tracking the number of items waiting in the controller work queue (i.e., reconciliation backlog).
Labels:
name: Controller queue name (e.g.,user)
Note:
kubeuser_workqueue_depthwas removed. Useworkqueue_depth{name="user"}as the practical replacement: it tracks reconciliation backlog, which is the actionable signal for SRE monitoring and alerting.controller_runtime_active_workers{controller="user"}is also exposed automatically but is bounded byMaxConcurrentReconciles(default1), so it's only meaningful when concurrency is tuned up.
Gauge tracking number of concurrent certificate rotations.
Gauge tracking number of pending rotations in queue.
Counter tracking rotations throttled to prevent thundering herd.
Gauge tracking certificate expiry time as Unix timestamp.
Labels:
namespace: User namespaceuser: User namecert_type: Certificate type (e.g.,client)
Gauge tracking number of certificates expiring within 24 hours.
Labels:
namespace: User namespace
Gauge tracking number of certificates expiring within 7 days.
Labels:
namespace: User namespace
rate(kubeuser_cert_rotations_total[5m])
sum(rate(kubeuser_cert_rotations_total{status="success"}[5m]))
/
sum(rate(kubeuser_cert_rotations_total[5m]))
histogram_quantile(0.95, rate(kubeuser_cert_rotation_duration_seconds_bucket[5m]))
sum by (namespace) (kubeuser_certs_expiring_24h)
rate(kubeuser_reconciliations_total{result="error"}[5m])
histogram_quantile(0.99, rate(kubeuser_reconcile_duration_seconds_bucket[5m]))
Example Prometheus alerting rules:
groups:
- name: kubeuser
rules:
- alert: HighCertRotationFailureRate
expr: |
sum(rate(kubeuser_cert_rotations_total{status="failure"}[5m]))
/
sum(rate(kubeuser_cert_rotations_total[5m])) > 0.1
for: 10m
labels:
severity: warning
annotations:
summary: "High certificate rotation failure rate"
description: "{{ $value | humanizePercentage }} of rotations are failing"
- alert: CertificatesExpiringSoon
expr: kubeuser_certs_expiring_24h > 0
for: 1h
labels:
severity: critical
annotations:
summary: "Certificates expiring within 24 hours"
description: "{{ $value }} certificates in {{ $labels.namespace }} expire within 24h"
- alert: SlowReconciliation
expr: |
histogram_quantile(0.99,
rate(kubeuser_reconcile_duration_seconds_bucket[5m])
) > 30
for: 15m
labels:
severity: warning
annotations:
summary: "Slow reconciliation performance"
description: "P99 reconciliation time is {{ $value }}s"
- alert: HighRotationQueueDepth
expr: kubeuser_rotation_queue_length > 100
for: 10m
labels:
severity: warning
annotations:
summary: "High rotation queue depth"
description: "{{ $value }} rotations pending in queue"A pre-built Grafana dashboard is available at config/grafana/kubeuser-dashboard.json, compatible with kube-prometheus-stack.
Key panels included:
- Certificate rotation rate and success rate
- Rotation duration histogram
- Active users by namespace
- Certificates expiring soon
- Reconciliation performance
- Error rates by type