Member-only story
Understanding Kubernetes: Part 27 Role and RoleBinding
📢 If you’ve been following our Kubernetes series 2025, welcome back! For new readers, check out Part 26: Preemption and Priority
📖 Not a Medium member? No worries! Here’s the free link: Part 27 — Role and RoleBinding
Introduction
Kubernetes Role and RoleBinding are essential components of Role-Based Access Control (RBAC). They define permissions within a Kubernetes cluster, ensuring that users and applications only have the access they need.
What is a Role?
A Role is a namespaced Kubernetes object that defines a set of permissions within a specific namespace. It grants access to resources such as Pods, ConfigMaps, and Deployments based on verbs (actions) like get
, list
, create
, delete
, and update
.
Example: Creating a Role
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: pod-reader
namespace: default
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list"]
This Role named pod-reader
allows users to get
and list
Pods within the default
namespace.