diff --git a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go index 2ec187937c0..993e48a2aa1 100644 --- a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go +++ b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go @@ -283,6 +283,9 @@ func ClusterRoles() []rbacv1.ClusterRole { "/livez", "/readyz", "/healthz", "/livez/*", "/readyz/*", "/healthz/*", ).RuleOrDie(), + + // Needed for kubelet metrics + rbacv1helpers.NewRule("get").Groups(legacyGroup).Resources("nodes/metrics").RuleOrDie(), } if utilfeature.DefaultFeatureGate.Enabled(zpagesfeatures.ComponentFlagz) { diff --git a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles-featuregates.yaml b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles-featuregates.yaml index ab02ccd3f6e..640da9b23ce 100644 --- a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles-featuregates.yaml +++ b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles-featuregates.yaml @@ -1015,6 +1015,12 @@ items: - /readyz/* verbs: - get + - apiGroups: + - "" + resources: + - nodes/metrics + verbs: + - get - nonResourceURLs: - /flagz verbs: diff --git a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml index 6446507d130..47e80ef206d 100644 --- a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml +++ b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml @@ -923,6 +923,12 @@ items: - /readyz/* verbs: - get + - apiGroups: + - "" + resources: + - nodes/metrics + verbs: + - get - apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: