Sobes.tech
Junior — Middle

Can you list the main types of abstractions in Kubernetes that provide access control to functionality?

sobes.tech AI

Answer from AI

In Kubernetes, the following main abstractions are used to differentiate access to functionality:

  • Role and ClusterRole — define a set of permissions for actions on resources within a namespace (Role) or at the cluster level (ClusterRole).

  • RoleBinding and ClusterRoleBinding — bind roles to users, groups, or service accounts, granting them the corresponding rights.

These abstractions implement the RBAC (Role-Based Access Control) model, which allows flexible management of access to Kubernetes resources.

Example of creating a Role and RoleBinding:

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  namespace: default
  name: pod-reader
rules:
- apiGroups: [""]
  resources: ["pods"]
  verbs: ["get", "watch", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: read-pods
  namespace: default
subjects:
- kind: User
  name: jane
  apiGroup: rbac.authorization.k8s.io
roleRef:
  kind: Role
  name: pod-reader
  apiGroup: rbac.authorization.k8s.io

Thus, Kubernetes provides access control through roles and role bindings.

Can you list the main types of abstractions in… - sobes.tech