diff --git a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go index b0470fb53e4..40cacf5c416 100644 --- a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go +++ b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go @@ -219,6 +219,16 @@ func ClusterRoles() []rbac.ClusterRole { rbac.NewRule("get").Groups(legacyGroup).Resources("endpoints").RuleOrDie(), }, }, + { + // a role to use for node-problem-detector access. It does not get bound to default location since + // deployment locations can reasonably vary. + ObjectMeta: metav1.ObjectMeta{Name: "system:node-problem-detector"}, + Rules: []rbac.PolicyRule{ + rbac.NewRule("get").Groups(legacyGroup).Resources("nodes").RuleOrDie(), + rbac.NewRule("patch").Groups(legacyGroup).Resources("nodes/status").RuleOrDie(), + eventsRule(), + }, + }, { // a role to use for setting up a proxy ObjectMeta: metav1.ObjectMeta{Name: "system:node-proxier"}, 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 dabcfe35337..cbb258ab1de 100644 --- a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml +++ b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml @@ -594,6 +594,34 @@ items: - get - list - watch +- apiVersion: rbac.authorization.k8s.io/v1alpha1 + kind: ClusterRole + metadata: + creationTimestamp: null + labels: + kubernetes.io/bootstrapping: rbac-defaults + name: system:node-problem-detector + rules: + - apiGroups: + - "" + resources: + - nodes + verbs: + - get + - apiGroups: + - "" + resources: + - nodes/status + verbs: + - patch + - apiGroups: + - "" + resources: + - events + verbs: + - create + - patch + - update - apiVersion: rbac.authorization.k8s.io/v1alpha1 kind: ClusterRole metadata: