Skip to content

Conversation

@romankucherov-cmyk
Copy link

Fixes #6161

What this PR does / why we need it

Prevents false positives in KubeClientCertificateExpiration alert when using cloud providers that renew certificates exactly 7 days before expiration.

Problem

Cloud providers like DigitalOcean automatically renew certificates 7 days before expiration, causing the alert to trigger during normal maintenance operations.

Solution

Change warning threshold from 7 days (604,800s) to 6 days 22 hours (601,200s) to create a 2-hour buffer.

Changes

  • Single line change: 604800601200 in alert rule
  • Prevents false positives during cloud provider maintenance
  • Maintains security monitoring for real certificate issues
  • Critical alert (<24h) remains unchanged for emergencies

Testing

  • Mathematically ensures cloud provider maintenance won't trigger warnings
  • Still provides 6+ days warning for real certificate issues
  • Backward compatible - no breaking changes

Fix KubeClientCertificateExpiration false positives with cloud providers

Signed-off-by: romankucherov-cmyk <[email protected]>
[kube-prometheus-stack] Fix KubeClientCertificateExpiration false positives with cloud providers
@romankucherov-cmyk romankucherov-cmyk changed the title KubeClientCertificateExpiration alert false positives with cloud providers #6160 KubeClientCertificateExpiration alert false positives with cloud providers #6161 Sep 25, 2025
Signed-off-by: romankucherov-cmyk <[email protected]>
Signed-off-by: romankucherov-cmyk <[email protected]>
'$.Values.defaultRules.node.fsSelector': {
'replacement': '{{ $.Values.defaultRules.node.fsSelector }}',
'init': ''},
'601200': {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment here

windows: true


kubeClientCertificateExpiration: "601200"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add more context/comments here.

Copy link
Member

@jkroepke jkroepke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The replacement doesn't hit. I can't see any visible notes in charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kubernetes-system-apiserver.yaml.

And please bump the chart version, thanks!

Signed-off-by: romankucherov-cmyk <[email protected]>
Signed-off-by: romankucherov-cmyk <[email protected]>
Signed-off-by: romankucherov-cmyk <[email protected]>
@romankucherov-cmyk
Copy link
Author

The replacement doesn't hit. I can't see any visible notes in charts/kube-prometheus-stack/templates/prometheus/rules-1.14/kubernetes-system-apiserver.yaml.

And please bump the chart version, thanks!

Added comments to fsSelector and kubeClientCertificateExpiration in both values.yaml and sync_prometheus_rules.py. Verified with helm template — these values are currently not used in any rendered templates, so the replacement doesn’t hit. Left them documented for future/compatibility reasons. Also bumped the chart version.

@jkroepke
Copy link
Member

jkroepke commented Oct 7, 2025

future/compatibility reasons

Ok, I would leave the PR open until the replacements hits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KubeClientCertificateExpiration alert false positives with cloud providers

2 participants