<pre><code>kubectl get sa --all-namespaces 
</code></pre>
<p>This will only provide the service accounts.</p>
<p>In general, you can have a comma separated list of resources to display.</p>
<p>Example:</p>
<pre><code>kubectl get pods,svc,sa,deployments [-FLAGS]
</code></pre>
<p>The FLAGS would apply to all the resources.</p>

CC BY-SA 4.0
2022-04-21T12:54:21.027Z
This is what I was looking for, and worked for me. Thanks!
mkumar118
CC BY-SA 4.0
2019-08-29T13:21:48.413Z
2024-08-02T11:21:52.640Z
2024-08-02T11:21:52.640Z
tnsh
<p>The command you listed will show you your resources.</p>

<p>Instead try: <code>kubectl get serviceAccounts</code></p>

CC BY-SA 4.0
2019-08-27T20:11:26.560Z
Is there a way to get everything? I actually want to see resources, service accounts, cluster role bindings, everything. I am trying to clean up my nodes and would appreciate a way to get a birds eye view.
David West
CC BY-SA 4.0
2019-08-27T20:15:08.093Z
Are you trying to get all the information tied to that service account?  If so check out the official docs here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/.  Otherwise you may want to look into https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/ for a dashboard or chain commands together (e.g. kubectl get --all-namespaces && kubectl get serviceAccounts)
Wesley Rolnick
CC BY-SA 4.0
2019-08-27T20:24:05.817Z
Popeye helps... https://github.com/derailed/popeye
David West
CC BY-SA 4.0
2021-12-17T13:44:21.037Z
if your `serviceAccount` is not in your current `namespace` you should use `-A` for looking on all your `namespaces` or target an specific one with `-n=foobar` if you know in which `namespace` is your resource.
Juan-Kabbali
CC BY-SA 4.0
2019-08-27T20:06:30.500Z
2019-08-27T20:06:30.500Z
Wesley Rolnick
<p>How do I show all service accounts In Kubernetes?</p>

<p>I have tried <code>kubectl get --all-namespaces all</code>. It does not show service accounts.</p>

<p>How can I use <code>kubectl</code> to list all service accounts?</p>

<kubernetes><kubectl><gcp>
Kubernetes - How to show all service accounts
David West
# Kubernetes - How to show all service accounts

(Asked by: username_0 on 2019-08-27)

How do I show all service accounts In Kubernetes?

I have tried `kubectl get --all-namespaces all`. It does not show service accounts.

How can I use `kubectl` to list all service accounts?

**Tags:** kubernetes, kubectl, gcp


---

## 2 answers

### Answer by username_3 on 2019-08-27. Score: 16 | Accepted answer

The command you listed will show you your resources.

Instead try: `kubectl get serviceAccounts`

> **Comments:**
> **username_0**: Is there a way to get everything? I actually want to see resources, service accounts, cluster role bindings, everything. I am trying to clean up my nodes and would appreciate a way to get a birds eye view.  
> **username_3**: Are you trying to get all the information tied to that service account?  If so check out the official docs here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/.  Otherwise you may want to look into https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/ for a dashboard or chain commands together (e.g. kubectl get --all-namespaces && kubectl get serviceAccounts)  
> **username_0**: Popeye helps... https://github.com/derailed/popeye  
> **username_4**: if your `serviceAccount` is not in your current `namespace` you should use `-A` for looking on all your `namespaces` or target an specific one with `-n=foobar` if you know in which `namespace` is your resource.  

---

### Answer by username_1 on 2019-08-29. Score: 10

kubectl get sa --all-namespaces 

This will only provide the service accounts.
In general, you can have a comma separated list of resources to display.
Example:
kubectl get pods,svc,sa,deployments [-FLAGS]

The FLAGS would apply to all the resources.

> **Comments:**
> **username_2**: This is what I was looking for, and worked for me. Thanks!  

---

