在单个节点Kubernetes集群上工作时,我希望将限制性pod安全策略应用于一组通过openid进行身份验证的用户。步骤顺序是这样的。
PodSecurityPolicy (这会导致API服务器重新启动)ClusterRole和RoleBinding。通过openid对用户进行身份验证并获取其组很好,但是,将PodSecurityPolicy限制在这个组并不有效。下面给出的示例ClusterRole和RoleBinding。如果我使用system:authenticated而不是mygroup,则会为新的荚创建选择策略。
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: psp:restricted
rules:
- apiGroups:
- extensions
resources:
- podsecuritypolicies
resourceNames:
- restricted # the psp we are giving access to
verbs:
- use
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: psp:restricted
subjects:
- kind: Group
name: mygroup # My group from openid, DOESN'T WORK.
# name: system:authenticated # all authenticated users, WORKS.
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: ClusterRole
name: psp:restricted # A references to the role above
apiGroup: rbac.authorization.k8s.io发布于 2019-08-30 15:48:30
我想我可能有类似的问题,并发现这是一个问题,我的角色。你可以在为什么即使我没有访问权限也应用我的PodSecurityPolicy?查看我的问题/答案
https://stackoverflow.com/questions/55852409
复制相似问题