<p>I am running a <strong>Kubernates Cluster</strong> in bare metal of three nodes.
I have applied a couple of <strong>yaml</strong> files of different services.
Now I would like to make order in the cluster and <strong>clean</strong> some orphaned kube objects.
To do that I need to understand the set of pods or other entities which use or refer a certain <strong>ServiceAccount</strong>.</p>

<p>For example, I can dig ClusterRoleBinding of the, say, admin-user and investigate it:</p>

<pre><code>kubectl get сlusterrolebinding admin-user
</code></pre>

<p>But is there a good <code>kubectl</code> options combination to find <strong>all the usages/references</strong> of some <strong>ServiceAccount</strong>?</p>

alex007
<p>Take a look at this <a href="https://github.com/FairwindsOps/rbac-lookup" rel="nofollow noreferrer">project</a>. After installing via homebrew or krew you can use it find a service account and look at its role, scope, source. It does not tell which pods are referring to it but still a useful tool.</p>

<pre><code>rbac-lookup serviceaccountname --output wide --kind serviceaccount
</code></pre>
