【问题标题】:RBAC for GKE cluster用于 GKE 集群的 RBAC
【发布时间】:2021-11-15 06:44:21
【问题描述】:

我正在尝试在我的 GKE 集群中使用 RBAC 策略,因此我需要将视图角色强制执行到一个组,并将管理员角色强制到另一个组。我有 2 个组为 RBAC 策略创建了 abc@example.com 和 def@example.com,我可以直接在我的 ClusterRoleBinding yaml 文件中引用它们,例如:

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: view-role
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: view
subjects:
- apiGroup: rbac.authorization.k8s.io
  kind: Group
  name: "abc@example.com"

或者我应该启用“Google Groups for RBAC”并创建一个组“gke-security-groups@YOUR_DOMAIN”(https://cloud.google.com/kubernetes-engine/docs/how-to/role-based-access-control#rolebinding)并将上述组添加到其中,然后在 GKE 集群中创建 RBAC 规则?

我创建了上面的 ClusterRoleBinding 没有任何改变(没有启用“用于 RBAC 的 Google 组”),请告诉我如何将 RBAC 访问应用于 GKE 集群中的组?

【问题讨论】:

    标签: google-cloud-platform google-kubernetes-engine


    【解决方案1】:

    我的假设是您已经创建/设置了您的谷歌群组。如果没有,请查看指向Configure Google Groups for RBAC 的链接,并且您必须更新集群以启用 RBAC 功能。

    要将现有集群更新为 Enable the Google Groups for RBAC feature,请在 Google Cloud Console 中执行以下步骤:

    1. 转到 Cloud Console 中的 Google Kubernetes Engine 页面。

    2. 转到 Google Kubernetes 引擎

    3. 在您要编辑的集群旁边,点击more_vert Actions,然后点击edit Edit。

    4. 在“详细信息”选项卡下,对于“适用于 RBAC 的 Google 群组”字段,点击“编辑”编辑适用于 RBAC 的 Google 群组。

    5. 选中为 RBAC 启用 Google 群组复选框。

    6. 输入您的安全组名称。

    7. 点击保存更改。

    【讨论】:

      猜你喜欢
      • 2020-10-23
      • 2018-12-14
      • 2017-10-10
      • 2018-07-02
      • 2019-12-01
      • 2023-01-07
      • 2021-07-12
      • 2019-06-06
      • 1970-01-01
      相关资源
      最近更新 更多