Jeremy Lewi
Jeremy Lewi

Reputation: 6776

Get clusterrolebindings for an account?

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

Answers (1)

sfgroups
sfgroups

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

Related Questions