Reputation: 6776
How can I use kubectl to get all the roles that a service account has?
I can check the accounts bound to a particular role by doing
kubectl get clusterrolebindings somerole
Do I need to get all roles and then filter down?
Upvotes: 0
Views: 252
Reputation: 19099
we can use this one. system:authenticated
service account part of two roles
kubectl get clusterrolebindings -o=jsonpath='{.items[?(@.subjects[].name=="system:authenticated")].roleRef.name}'
system:basic-user system:discovery
Upvotes: 1