Skip to content

[kube-state-metrics] add authFilter to enable native --auth-filter#7001

Open
yugstar wants to merge 1 commit into
prometheus-community:mainfrom
yugstar:feat-6787-ksm-auth-filter
Open

[kube-state-metrics] add authFilter to enable native --auth-filter#7001
yugstar wants to merge 1 commit into
prometheus-community:mainfrom
yugstar:feat-6787-ksm-auth-filter

Conversation

@yugstar

@yugstar yugstar commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Adds an authFilter.enabled value that makes kube-state-metrics' native request authn/authz (--auth-filter) easy to turn on, as an alternative to kube-rbac-proxy.

Currently operators have to hand-wire this via extraArgs: [--auth-filter] plus rbac.extraRules for tokenreviews/subjectaccessreviews (as described in #6787). With this change, authFilter.enabled: true:

  • adds the --auth-filter flag to the kube-state-metrics container, and
  • adds the create permissions on tokenreviews and subjectaccessreviews that the filter requires.

The RBAC rules are not duplicated: the chart already renders them when kubeRBACProxy.enabled is true, so I extended that gate to or kubeRBACProxy.enabled authFilter.enabled. Defaults are unchanged (feature is off by default; kube-rbac-proxy behavior is untouched). A README section documents it alongside kube-rbac-proxy, including a pointer to the upstream docs for the scraper-side ClusterRole/ClusterRoleBinding.

Verified with helm template across all gate combinations and helm lint (0 failures).

Closes #6787

Add an authFilter.enabled value that wires up kube-state-metrics native
request authn/authz: it adds the --auth-filter flag and the create
permissions on tokenreviews and subjectaccessreviews the filter requires.
The RBAC rules reuse the existing block (previously gated only on
kubeRBACProxy.enabled) by extending the gate, so they are not duplicated.
Bump the chart to a new minor version and document the feature in the
README alongside kube-rbac-proxy.

Closes prometheus-community#6787

Signed-off-by: Aman Raj <aman.yug@gmail.com>
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.

[kube-state-metrics] Allow easy configuring of --auth-filter

2 participants