get vs. list in Kubernetes RBAC
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
In Kubernetes RBAC, get and list are not interchangeable. get allows reading one named resource, while list allows reading a collection of resources. That difference matters operationally because a user who can get a pod by name may still be unable to run commands that enumerate pods across a namespace.
What get Means
get is the permission to read a single resource instance when you already know which object you want.
Example:
For the API, this is roughly equivalent to:
If RBAC grants get on pods, this request can succeed even if list is not allowed.
What list Means
list is the permission to retrieve a collection of resources.
Example:
This maps more closely to:
That is a different RBAC verb because the caller is not requesting one known object. The caller is enumerating the set.
Why the Distinction Matters
The distinction is important for least privilege.
Granting get means:
- the subject can inspect a specific object if it knows the name.
Granting list means:
- the subject can discover which objects exist in the first place.
That discovery ability is often more sensitive than people assume. In multi-tenant or tightly controlled clusters, enumeration is a meaningful privilege.
Example Roles
Role with only get:
Role with get and list:
These two roles look similar, but they enable different CLI behavior.
kubectl Often Needs More Than You Think
Some commands that look simple can require list, not just get. For example:
- '
kubectl get podsneedslist,' - dashboards and UIs often need
list, - controllers and operators often need
listpluswatch.
Meanwhile:
- '
kubectl get pod my-podneedsget.'
That is why users sometimes report “I can fetch one pod but I cannot see all pods.” The RBAC policy is behaving exactly as defined.
watch Is Separate Too
Do not confuse list with watch. Many controllers need both:
- '
listto get the initial state,' - '
watchto stream changes.'
A common production pattern is:
But if your use case is narrower, grant only what the client actually needs.
How to Think About It Operationally
Use get when a subject should inspect a known resource.
Use list when a subject should enumerate resources in a scope.
Use both when the client needs both behaviors.
This is the same mental model many REST APIs use: reading one object and enumerating a collection are different permissions because they expose different amounts of information.
Testing the Difference
You can verify behavior with impersonation if you have the right administrative privileges:
This makes RBAC debugging much faster than guessing from failed commands alone.
Common Pitfalls
- Assuming
getimplieslistbecause both are “read-only” permissions. - Granting
listcasually without considering that it allows object discovery across a namespace or cluster scope. - Forgetting that many tools and dashboards need
listeven when a human only thinks in terms of “read access.” - Omitting
watchfor controllers that need ongoing updates after the initial list call. - Debugging failed
kubectl get podscommands without checking whether the real missing verb islist, notget.
Summary
- '
getreads one known resource, whilelistenumerates a resource collection.' - A subject can have
getwithoutlist, and the difference is meaningful in RBAC design. - '
kubectl get pod my-podandkubectl get podsmap to different permissions.' - '
listis often paired withwatchfor controllers and observability tools.' - Use
kubectl auth can-ito confirm exactly which verb is missing.
Related reading
- Get YAML for deployed Kubernetes services?
- Getting bad option; for several filesystems e.g. nfs, cifs when trying to mount azure file share in K8 container
- Getting ErrImageNeverPull in pods
- Getting error ipfamily IPv6 is not configured on cluster when applying kubectl apply service.yaml
- Getting a list of all subdirectories in the current directory
- Getting a list of values from a list of dicts
- GitLab-CI Kubernetes Variables aren't set?
- GKE - How to serve HTTPS via the L7 load balancer?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.