# How to List all Containers Running in a Cluster

## Problem

View all the containers runnings inside a cluster.

## Environment

* Platform9 Managed Kubernetes - All Versions
* kubectl

## Procedure

1. Download the kubeconfig for the cluster you want the information for.
2. Save the kubeconfig at the following path *\~/.kube/config* or run the kubectl command with the *--kubeconfig=* command
3. Run the following command to get a list and number of running containers of each type.

{% tabs %}
{% tab title="Bash" %}

```bash
kubectl get pods --all-namespaces -o jsonpath="{.items[*].spec.containers[*].name}" | tr -s ' ' '<br>' |sort |uniq -c
```

{% endtab %}
{% endtabs %}

## Additional Information

You can obtain other information about the containers by changing the *spec.* value. For example you can get a list and number of all images running in a cluster by running the above command with *`spec.containers[*].image`.*
