Skip to content

OCPBUGS-95087: reload client CA after kubelet-ca.crt is replaced - #150

Open
arpitbhagat wants to merge 1 commit into
openshift:release-4.19from
arpitbhagat:OCPBUGS-95087-file-ca-poll-release-4.19
Open

OCPBUGS-95087: reload client CA after kubelet-ca.crt is replaced#150
arpitbhagat wants to merge 1 commit into
openshift:release-4.19from
arpitbhagat:OCPBUGS-95087-file-ca-poll-release-4.19

Conversation

@arpitbhagat

Copy link
Copy Markdown

What type of PR is this?

/kind bug

What this PR does / why we need it:

OpenShift scrapes CRI-O metrics through the kube-rbac-proxy-crio static pod on :9637 (job=crio). That process authenticates Prometheus with --client-ca-file=/etc/kubernetes/kubelet-ca.crt. Machine Config Operator writes that file atomically whenever the cluster client CA is updated.

Today kube-rbac-proxy loads the CA at start (and on filesystem events for the original inode) and then keeps it in memory. After MCO replaces the file, TLS to :9637 still succeeds, but client-certificate authentication returns HTTP 401 (x509: certificate signed by unknown authority). Cluster Monitoring then fires TargetDown for job=crio. Restarting the static pod reloads the CA from disk and clears the alert until the next CA rewrite.

This change reloads the client CA on a one-minute timer as well as on filesystem events, so an MCO rewrite is picked up without restarting the proxy. The same reload is applied to the serving cert/key watcher so those files cannot stick on a stale inode either.

Which issue(s) this PR is related to:

Related: OCPBUGS-95087

Special notes for your reviewer:

  • Reload interval stays 1 minute.
  • Authentication and authorization wiring is unchanged (--client-ca-file, static auth for prometheus-k8s).

Does this PR introduce a user-facing change?

kube-rbac-proxy now reloads the client CA file on a timer, so replacing kubelet-ca.crt no longer leaves CRI-O metrics scrapes failing with HTTP 401.

kube-rbac-proxy-crio authenticates Prometheus with --client-ca-file
/etc/kubernetes/kubelet-ca.crt. After MCO replaces that file, the
process can keep a stale in-memory CA and return HTTP 401 while TLS
still succeeds. Reload the client CA (and serving cert/key) on a 1m
timer as well as on filesystem events so TargetDown job=crio does not
stick until a process restart.

Related: OCPBUGS-95087
Signed-off-by: Arpit Bhagat <arpitbhagat@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@openshift-merge-bot

Copy link
Copy Markdown

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci openshift-ci Bot added the kind/bug Categorizes issue or PR as related to a bug. label Sep 9, 2026
@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Sep 9, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@arpitbhagat: This pull request references Jira Issue OCPBUGS-95087, which is invalid:

  • release note text must be set and not match the template OR release note type must be set to "Release Note Not Required". For more information you can reference the OpenShift Bug Process.
  • expected Jira Issue OCPBUGS-95087 to depend on a bug targeting a version in 4.20.0, 4.20.z and in one of the following states: VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA), but no dependents were found

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

What type of PR is this?

/kind bug

What this PR does / why we need it:

OpenShift scrapes CRI-O metrics through the kube-rbac-proxy-crio static pod on :9637 (job=crio). That process authenticates Prometheus with --client-ca-file=/etc/kubernetes/kubelet-ca.crt. Machine Config Operator writes that file atomically whenever the cluster client CA is updated.

Today kube-rbac-proxy loads the CA at start (and on filesystem events for the original inode) and then keeps it in memory. After MCO replaces the file, TLS to :9637 still succeeds, but client-certificate authentication returns HTTP 401 (x509: certificate signed by unknown authority). Cluster Monitoring then fires TargetDown for job=crio. Restarting the static pod reloads the CA from disk and clears the alert until the next CA rewrite.

This change reloads the client CA on a one-minute timer as well as on filesystem events, so an MCO rewrite is picked up without restarting the proxy. The same reload is applied to the serving cert/key watcher so those files cannot stick on a stale inode either.

Which issue(s) this PR is related to:

Related: OCPBUGS-95087

Special notes for your reviewer:

  • Reload interval stays 1 minute.
  • Authentication and authorization wiring is unchanged (--client-ca-file, static auth for prometheus-k8s).

Does this PR introduce a user-facing change?

kube-rbac-proxy now reloads the client CA file on a timer, so replacing kubelet-ca.crt no longer leaves CRI-O metrics scrapes failing with HTTP 401.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 72918418-fb64-463f-8cce-4ff856cfa0df

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@openshift-ci
openshift-ci Bot requested review from ibihim and liouk September 9, 2026 22:44
@openshift-ci

openshift-ci Bot commented Sep 9, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: arpitbhagat
Once this PR has been reviewed and has the lgtm label, please assign ibihim for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci

openshift-ci Bot commented Sep 9, 2026

Copy link
Copy Markdown

Hi @arpitbhagat. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. kind/bug Categorizes issue or PR as related to a bug. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants