1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| # 这个角色绑定允许 "user-test" 读取 "test-ns" 命名空间下所有权限
# 上面已经在该命名空间中创建一个名为 "test-ns-role"的角色。
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: test-user-rb
namespace: test-ns
subjects: # 你可以指定一个以上的 "subject"
#- kind: User
# name: test-user # "name" 是大小写敏感的
# apiGroup: rbac.authorization.k8s.io
- kind: ServiceAccount
name: user-test
namespace: test-ns
roleRef: # "roleRef" 指定绑定到一个 Role/ClusterRole
kind: Role # 必须是 Role 或 ClusterRole
name: test-ns-role # 这必须与你想绑定的 Role 或 ClusterRole 的名字相匹配
apiGroup: rbac.authorization.k8s.io
|