我要去Kubernetes的RBAC。在我看来
单个服务帐户(或用户)是否可能不具有群集范围的访问权限,但只能在命名空间的子集中具有只读访问权限?如果是这样,有人可以详细说明如何实现这一目标。谢谢!
您需要为ServiceAccount应有权访问的每个命名空间中的每个命名空间创建一个RoleBinding。
有一个示例可以提供默认的ServiceAccount权限来读取development
命名空间中的pod。
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: read-secrets
namespace: development # This only grants permissions within the "development" namespace.
subjects:
- kind: ServiceAccount
name: default
namespace: kube-system
roleRef:
kind: Role
name: pod-reader
apiGroup: rbac.authorization.k8s.io