created/used 部署使用 istio 的服务应该扮演什么角色?

What roles should be created/used for deploying a service that uses istio?

我正在构建一个支持 istio 的 RBAC AKS 集群。我分配了集群管理员角色,我能够毫无问题地成功部署最小的 istio 服务 (Service/Deployment/Gateway/VirtualService)。

我需要授予我组织内的团队访问 AKS 的权限,因此我创建了一个命名空间并为他们分配了命名空间的管理员角色。 k8s 原生的一切(kubectl get services --namespace team)都运行良好。然而,当他们去部署相同的最小 istio 服务 (Service/Deployment/Gateway/VirtualService) 时,他们遇到了很多类似的错误:

Error from server (Forbidden): error when retrieving current configuration of:
Resource: "networking.istio.io/v1alpha3, Resource=gateways", GroupVersionKind: "networking.istio.io/v1alpha3, Kind=Gateway"

这是有道理的,因为我没有将该组绑定到任何 istio 角色。一旦我授予他们集群管理员权限,它就会按预期工作。

问题是,我不知道要添加哪些 istio 角色。当我查看安装 istio 后集群中存在的角色时,我没有看到任何明显的角色。

我看到的角色:

需要在 istio 部署(命名空间内)上操作的用户的适当角色是什么?是角色的组合吗?我需要一个新角色吗?

像这样的角色应该有效:

"apiGroups": [
    "istio.io"
],
"resources": [
    "*"
],
"verbs": [
    "*"
]

如果这不起作用,您需要执行以下操作:

"apiGroups": [
    "config.istio.io",
    "networking.istio.io",
    "rbac.istio.io",
    "authentication.istio.io"
],
"resources": [
    "*"
],
"verbs": [
    "*"
]

您可以为您的用户创建角色或集群角色和绑定或角色绑定。

我使用了以下聚合到默认 edit(进而 admin)ClusterRoles。然后任何绑定到 editadmin 的帐户都可以修改 Istio 资源:

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  labels:
    rbac.authorization.k8s.io/aggregate-to-edit: "true"
  name: istio-edit
rules:
- apiGroups:
  - "config.istio.io"
  - "networking.istio.io"
  - "rbac.istio.io"
  - "authentication.istio.io"
  - "security.istio.io"
  resources:
  - "*"
  verbs:
  - "*"