mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-09 05:01:46 +00:00
Merge pull request #93311 from logicalhan/monitoring-role
Add bootstrap policy for monitoring endpoints
This commit is contained in:
@@ -196,7 +196,8 @@ func ClusterRoles() []rbacv1.ClusterRole {
|
||||
},
|
||||
},
|
||||
{
|
||||
// a role which provides just enough power to determine if the server is ready and discover API versions for negotiation
|
||||
// a role which provides just enough power to determine if the server is
|
||||
// ready and discover API versions for negotiation
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "system:discovery"},
|
||||
Rules: []rbacv1.PolicyRule{
|
||||
rbacv1helpers.NewRule("get").URLs(
|
||||
@@ -208,6 +209,20 @@ func ClusterRoles() []rbacv1.ClusterRole {
|
||||
).RuleOrDie(),
|
||||
},
|
||||
},
|
||||
{
|
||||
// a role which provides minimal read access to the monitoring endpoints
|
||||
// (i.e. /metrics, /livez/*, /readyz/*, /healthz/*, /livez, /readyz, /healthz)
|
||||
// The splatted health check endpoints allow read access to individual health check
|
||||
// endpoints which may contain more sensitive cluster information information
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "system:monitoring"},
|
||||
Rules: []rbacv1.PolicyRule{
|
||||
rbacv1helpers.NewRule("get").URLs(
|
||||
"/metrics",
|
||||
"/livez", "/readyz", "/healthz",
|
||||
"/livez/*", "/readyz/*", "/healthz/*",
|
||||
).RuleOrDie(),
|
||||
},
|
||||
},
|
||||
{
|
||||
// a role which provides minimal resource access to allow a "normal" user to learn information about themselves
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "system:basic-user"},
|
||||
@@ -563,6 +578,7 @@ const systemNodeRoleName = "system:node"
|
||||
func ClusterRoleBindings() []rbacv1.ClusterRoleBinding {
|
||||
rolebindings := []rbacv1.ClusterRoleBinding{
|
||||
rbacv1helpers.NewClusterBinding("cluster-admin").Groups(user.SystemPrivilegedGroup).BindingOrDie(),
|
||||
rbacv1helpers.NewClusterBinding("system:monitoring").Groups(user.MonitoringGroup).BindingOrDie(),
|
||||
rbacv1helpers.NewClusterBinding("system:discovery").Groups(user.AllAuthenticated).BindingOrDie(),
|
||||
rbacv1helpers.NewClusterBinding("system:basic-user").Groups(user.AllAuthenticated).BindingOrDie(),
|
||||
rbacv1helpers.NewClusterBinding("system:public-info-viewer").Groups(user.AllAuthenticated, user.AllUnauthenticated).BindingOrDie(),
|
||||
|
@@ -102,6 +102,23 @@ items:
|
||||
- apiGroup: rbac.authorization.k8s.io
|
||||
kind: User
|
||||
name: system:kube-scheduler
|
||||
- apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
annotations:
|
||||
rbac.authorization.kubernetes.io/autoupdate: "true"
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
kubernetes.io/bootstrapping: rbac-defaults
|
||||
name: system:monitoring
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:monitoring
|
||||
subjects:
|
||||
- apiGroup: rbac.authorization.k8s.io
|
||||
kind: Group
|
||||
name: system:monitoring
|
||||
- apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
|
@@ -861,6 +861,26 @@ items:
|
||||
- nodes/stats
|
||||
verbs:
|
||||
- '*'
|
||||
- apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
annotations:
|
||||
rbac.authorization.kubernetes.io/autoupdate: "true"
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
kubernetes.io/bootstrapping: rbac-defaults
|
||||
name: system:monitoring
|
||||
rules:
|
||||
- nonResourceURLs:
|
||||
- /healthz
|
||||
- /healthz/*
|
||||
- /livez
|
||||
- /livez/*
|
||||
- /metrics
|
||||
- /readyz
|
||||
- /readyz/*
|
||||
verbs:
|
||||
- get
|
||||
- apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
|
Reference in New Issue
Block a user