Search code examples
kubernetesnamespacesdevopsrolesrbac

Creating admin role for the namespace


I created an admin role for the namespace and build that so the role got created. However, I wanted to know whether creating a role to a namespace is enough or we need to create a user and configure some additional changes to apply that role? Please suggest.

Here is the role that I've created:

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"]

Solution

  • To read more about RBAC Authorization you can visit the official documentation, additionally there are some ready tutorials about configuring the RBAC like those:

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