2

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?

1

The command you listed will show you your resources.

Instead try: kubectl get serviceAccounts

4
  • 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
    Aug 27 '19 at 20:11
  • Are you trying to get all the information tied to that service account? If so check out the official docs here: kubernetes.io/docs/tasks/configure-pod-container/…. Otherwise you may want to look into kubernetes.io/docs/tasks/access-application-cluster/… for a dashboard or chain commands together (e.g. kubectl get --all-namespaces && kubectl get serviceAccounts) Aug 27 '19 at 20:15
  • Popeye helps... github.com/derailed/popeye
    – David West
    Aug 27 '19 at 20:24
  • 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. Dec 17 '21 at 13:44
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.