<p>Let's say I have a service account bound to a read-only role in some namespace <code>ns1</code>.</p>

<p>How can I get this token/user/ServiceAccount to namespace mapping, just by using <code>kubectl</code> or using REST calls to the API server? Put simply, I want to answer this question - Which namespace does this ServiceAccount belong to?</p>

<p>If I use the token bound to this service account to make REST API calls to get namespaces, it gives me a 403 Forbidden. I can be the admin and list all namespaces however, I cannot figure out the mapping in the question. Thanks!</p>

not_again_stackoverflow
<p>If you have the service account name:</p>

<pre><code>$ kubectl get serviceaccount &lt;service-account-name&gt; -o jsonpath='{.metadata.namespace}'
</code></pre>
