【问题标题】:How to find which role or clusterrole binded to a service account in Kubernetes?如何在 Kubernetes 中查找绑定到服务帐户的角色或集群角色?
【发布时间】:2019-09-02 22:26:35
【问题描述】:

kubectl 有没有办法找出哪些集群角色或角色绑定到服务帐户?

【问题讨论】:

    标签: kubernetes permissions rbac


    【解决方案1】:

    你可以这样做:

    kubectl get rolebindings,clusterrolebindings \
      --all-namespaces  \
      -o custom-columns='KIND:kind,NAMESPACE:metadata.namespace,NAME:metadata.name,SERVICE_ACCOUNTS:subjects[?(@.kind=="ServiceAccount")].name' | grep "<SERVICE_ACCOUNT_NAME>"
    

    将 grep 替换为您要查找的服务帐户的名称。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-08
      • 2021-10-28
      • 2020-03-26
      • 2020-12-23
      • 1970-01-01
      • 2021-07-25
      • 2021-07-11
      • 2020-08-30
      相关资源
      最近更新 更多