我正在尝试创建一个具有监视事件权限的群集角色,但似乎我丢失了某些内容。
我正在使用以下内容:
apiVersion: v1
kind: ServiceAccount
metadata:
name: watch-events
namespace: test
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: watch-events-cluster
rules:
- apiGroups:
- ""
resources:
- events
verbs:
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: watch-events-cluster
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: watch-events-cluster
subjects:
- kind: ServiceAccount
name: watch-events
namespace: test
没有其他问题,我总是会用no尝试使用kubectl -n test auth can-i watch events --as watch-events
。
我想念什么吗?
https://kubernetes.io/docs/reference/access-authn-authz/rbac/#service-account-permissions
默认RBAC策略向控制平面组件,节点和控制器授予范围内的权限,但不授予对kube-system命名空间之外的服务帐户的权限(除了授予所有已验证用户的发现权限之外)。