RBAC
Role-Based Access Control
Because Kubernetes RBAC is REST-based, it maps HTTP verbs to permissions. For example, POST is mapped to the create right.
The main recommendation is to give users the least privileges they need to get the job done.
Kubernetes objects are defined through different API specifications. RBAC is part of the rbac.authorization.k8s.io
API group — this group references four different types of Kubernetes objects:
Role, (WHAT can be done)
can be constrained to specific namespaces
ClusterRole, (WHAT can be done)
allows you to constrain access to resources that are cluster-wide, such as nodes
used for Non-resource REST Endpoints such as /healthz.
RoleBinding, (WHO can do it)
ClusterRoleBinding (WHO can do it)
![](https://amartyushov.gitbook.io/~gitbook/image?url=https%3A%2F%2F415484505-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LxtoAXZwwOc4XGto8vb%252Fuploads%252FM0na4D4NA9eR7hQYDlbe%252FScreenshot%25202022-05-16%2520at%252009.09.19.png%3Falt%3Dmedia%26token%3De2cd0bd0-72cd-41a4-9d26-c43750aaf96c&width=768&dpr=4&quality=100&sign=9334dc7c&sv=1)
Kubernetes RBAC differentiates between human resources and software resources:
User Accounts manage the access rights for users,
Service Accounts manage the access rights for software resources.
How kubectl works (partly). The API server executes the following operations sequentially:
On receiving the request, authenticate the user.
When the validation fails, reject the request by returning
401 Unauthorized
.Otherwise, move on to the next stage.
The user is authenticated, but do they have access to the resource?
If they don't, reject the request by returning
403 Forbidden
.Otherwise, continue.
Decoupling users and permission with RBAC roles
Last updated