Last active
May 31, 2022 15:49
-
-
Save sandipchitale/c795734f342c35b5e43c52e08e634bfb to your computer and use it in GitHub Desktop.
Show all users #kubectl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl get ClusterRoleBinding,RoleBinding -o jsonpath="{range .items[*]}{range .subjects[*]}{'\n'}{.kind}{','}{.name}{end}{end}" | wsl column -t -s "," -N Type,Name -R 1 | |
kubectl get ClusterRoleBinding,RoleBinding -o go-template-file=ugsa.tpl | wsl column -t -s ',' | |
REM Sort by user, group, sa type | |
kubectl get ClusterRoleBinding,RoleBinding -A -o go-template-file=%USERPROFILE%\.kube\ugsa.tpl | wsl { head -n 1; sort -k 1 -k 5 -k 6 -t ','; } | wsl column -t -s ',' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binding Type,Binding Name,Role Type,Role Name,Subject Type,Name | |
{{ range $item := .items -}} | |
{{- range $subject := .subjects -}}{{- $item.kind -}},{{- $item.metadata.name -}},{{- $item.roleRef.kind -}},{{- $item.roleRef.name -}},{{- $subject.kind}},{{- $subject.name }} | |
{{ end }} | |
{{- end }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment