How do you extract and verify RBAC for a ServiceAccount and find who can do what?
AdvancedProductionRapid-Fire Commands
Answer
kubectl get rolebinding,clusterrolebinding -A -o json | jq -r '.items[] | select(.subjects[]? | .kind=="ServiceAccount" and .name=="ci") | .metadata.namespace+"/"+.metadata.name+" -> "+.roleRef.name'
kubectl auth can-i --list --as=system:serviceaccount:shop:ci -n shop
kubectl who-can delete secrets -n shop # krew plugin
More on Rapid-Fire Commands
How do you list all Pods across namespaces with node and IP?BeginnerHow do you find why a Pod is Pending or not starting?BeginnerHow do you scale a Deployment or StatefulSet imperatively?BeginnerHow do you get a shell into a running container and run a one-off Pod?BeginnerHow do you see all resources and their short names?BeginnerHow do you generate YAML for a resource without creating it?Beginner