首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将PodSecurityPolicy的角色绑定到一个组?

如何将PodSecurityPolicy的角色绑定到一个组?
EN

Stack Overflow用户
提问于 2019-04-25 15:04:56
回答 1查看 221关注 0票数 0

在单个节点Kubernetes集群上工作时,我希望将限制性pod安全策略应用于一组通过openid进行身份验证的用户。步骤顺序是这样的。

  1. 初始化集群,并创建pod安全策略。
  2. 在API服务器中应用接纳控制器PodSecurityPolicy (这会导致API服务器重新启动)
  3. 为用户创建一个ClusterRoleRoleBinding

通过openid对用户进行身份验证并获取其组很好,但是,将PodSecurityPolicy限制在这个组并不有效。下面给出的示例ClusterRoleRoleBinding。如果我使用system:authenticated而不是mygroup,则会为新的荚创建选择策略。

代码语言:javascript
复制
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
  1. 如何对特定组执行RoleBinding安全策略?我上面的步骤有什么错误吗。我在这个组中还有其他的RoleBinding,它的工作非常好。
  2. 第二个问题是,法兰绒 pod没有出现,因为它似乎拿起了阻止卷装入等的限制性策略。我读到了政策的顺序很重要,并尝试将策略命名为将策略排序为最后一个策略。如果我稍后插入策略,并在初始化Flannel之后添加PodSecurityPolicy接纳控制器,那么一切看起来都很好。在插入政策时,我们是否必须遵守指令,入场控制人员?
EN

回答 1

Stack Overflow用户

发布于 2019-08-30 15:48:30

我想我可能有类似的问题,并发现这是一个问题,我的角色。你可以在为什么即使我没有访问权限也应用我的PodSecurityPolicy?查看我的问题/答案

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55852409

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档