Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zulhfreelancer/f50fb364600e80dd1ade16b4c87b4923 to your computer and use it in GitHub Desktop.
Save zulhfreelancer/f50fb364600e80dd1ade16b4c87b4923 to your computer and use it in GitHub Desktop.
How to find Kubernetes Role or ClusterRole linked to a specific ServiceAccount?

How to find Kubernetes Role or ClusterRole linked to a specific ServiceAccount?

kubectl get rolebinding,clusterrolebinding --all-namespaces -o jsonpath='{range .items[?(@.subjects[0].name=="SERVICE_ACCOUNT_NAME")]}[{.roleRef.kind},{.roleRef.name}]{end}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment