<p>We all know that <code>kubectl auth can-i &lt;verb&gt; &lt;resource&gt; --as=system:serviceaccount:&lt;namespace&gt;:&lt;serviceaccountname&gt; [-n &lt;namespace&gt;]</code> can be used to check if a serviceaccount has a specific permission, but is there a way that I can check what rol/clusterrole a serriceaccount is bound to?</p>

Winkee
<pre><code>    kubectl get rolebindings,clusterrolebindings \
  --all-namespaces  \
  -o custom-columns='KIND:kind,NAMESPACE:metadata.namespace,NAME:metadata.name,SERVICE_ACCOUNTS:subjects[?(@.kind==&quot;ServiceAccount&quot;)].name' | grep &quot;&lt;SERVICE_ACCOUNT_NAME&gt;&quot;
</code></pre>
