具有观看事件权限的Kubernetes群集角色

问题描述 投票:1回答:1

我正在尝试创建一个具有监视事件权限的群集角色,但似乎我丢失了某些内容。

我正在使用以下内容:

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

我想念什么吗?

kubernetes rbac
1个回答
0
投票

https://kubernetes.io/docs/reference/access-authn-authz/rbac/#service-account-permissions

默认RBAC策略向控制平面组件,节点和控制器授予范围内的权限,但不授予对kube-system命名空间之外的服务帐户的权限(除了授予所有已验证用户的发现权限之外)。

© www.soinside.com 2019 - 2024. All rights reserved.