Member-only story

Understanding Kubernetes: Part 27 Role and RoleBinding

techwithpatil
3 min readFeb 6, 2025

--

📢 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.

What is a RoleBinding?

--

--

techwithpatil
techwithpatil

Written by techwithpatil

DevOps & Site Realiability Interview | Cloud | AI Agent | Software Automation https://beacons.ai/techwithpatil

No responses yet