如何列出我当前的 RBAC 角色和所属组?

ani*_*kun 4 rbac kubernetes

我已通过 kubernetes 集群身份验证,如何查看附加到我当前帐户的 RBAC 角色和组?

ani*_*kun 5

找到更好的工具

这个工具看起来比 rakkess 好得多,
正是我想要的

https://github.com/reactiveops/rbac-lookup

在最简单的用例中,rbac-lookup 将返回任何匹配的用户、服务帐户或组以及所赋予的角色。

rbac-lookup rob

SUBJECT                   SCOPE             ROLE
rob@example.com           cluster-wide      ClusterRole/view
rob@example.com           nginx-ingress     ClusterRole/edit
The wide output option includes the kind of subject along with the source role binding.
Run Code Online (Sandbox Code Playgroud)
rbac-lookup ro --output wide

SUBJECT                   SCOPE             ROLE                SOURCE
User/rob@example.com      cluster-wide      ClusterRole/view    ClusterRoleBinding/rob-cluster-view
User/rob@example.com      nginx-ingress     ClusterRole/edit    RoleBinding/rob-edit
User/ron@example.com      web               ClusterRole/edit    RoleBinding/ron-edit
ServiceAccount/rops       infra             ClusterRole/admin   RoleBinding/rops-admin
Run Code Online (Sandbox Code Playgroud)

  • 您可以通过 [krew](https://github.com/kubernetes-sigs/krew) 使用这些工具和更多工具 (3认同)