Control access to resources in a cluster
Service accounts represent subjects
(Cluster)Role specifies what to allow on which resources
(Cluster)RoleBinding connects service accounts with one or more (Cluster)Roles
Role and RoleBinding are namespaced
ClusterRole and ClusterRoleBinding are cluster-wide
RoleBindings can reference a ClusteRole which is applied to a namespace
(Cluster)Roles can allow impersonation
One ServiceAccount can perform actions in the context of a second ServiceAccount
Useful for one cluster used by many teams
Read-only user per namespace
Impersonation to admin per namespace
Useful for one cluster used by a single team
Cluster-wide read-only user
Impersonation to admin per namespace
Use case 1
Namespace test
Read-only user test-reader
Admin user test-admin
Usage:
bash [3]
kubectl \
--namespace test \
--as=test-admin \
run -it --image=alpine --command \
-- \
sh