lgy
API 的定义是需要符合规范的,鉴权的大致流程为: 对请求意图进行解析 -> 根据资源所在的层级,对请求进行分层鉴权, 如果熟悉 K8s 原生的RBAC这些都很好理解。
如果你定义的资源API 为 /apis/device.kubesphere.io/v1alpha2/devices, 那么解析的request info 对应为list devices in
api group device.kubesphere.io
只需要kubectl edit globalrole platform-regular
在rules 中加上,便可以授权该资源的访问权限
- apiGroups:
- device.kubesphere.io
resources:
- 'devices'
verbs:
- get
- watch
- list