为命名空间创建管理员角色

Creating admin role for the namespace

我为命名空间创建了一个管理员角色并进行了构建,以便创建该角色。但是,我想知道为命名空间创建一个角色是否足够,或者我们需要创建一个用户并配置一些额外的更改来应用该角色?请提出建议。

这是我创建的角色:

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: admin
  namespace: temp
  labels:
    rbac.authorization.k8s.io/aggregate-to-admin: "true"
    rbac.authorization.k8s.io/aggregate-to-edit: "true"
rules:
- apiGroups: [""]
  resources: ["*"]
  verbs: ["get", "list", "watch", "create", "update", "patch"]

要阅读有关 RBAC 授权的更多信息,您可以访问 the official documentation,此外还有一些关于配置 RBAC 的现成教程,例如:

  1. Kubernetes Role-Based Access Control (RBAC)
  2. Mixing Kubernetes Roles, RoleBindings, ClusterRoles, and ClusterBindings
  3. RBAC, Namespaces and Cluster Roles