# How to List Workloads with Entity ID Under the Cluster Name Using Dynatrace API

**URL:** <https://community.dynatrace.com/t/how-to-list-workloads-with-entity-id-under-the-cluster-name-using-dynatrace-api/48404>\
**Category:** Dynatrace API\
**Tags:** dynatrace-api\
**Created:** [October 18, 2024, 12:25pm UTC](https://community.dynatrace.com/t/how-to-list-workloads-with-entity-id-under-the-cluster-name-using-dynatrace-api/48404 "2024-10-18T12:25:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vignesh179](https://avatars.discourse-cdn.com/v4/letter/v/4af34b/32.png) [@vignesh179](https://community.dynatrace.com/u/vignesh179)\
**Post date:** [October 18, 2024, 12:25pm UTC](https://community.dynatrace.com/t/how-to-list-workloads-with-entity-id-under-the-cluster-name-using-dynatrace-api/48404/1 "2024-10-18T12:25:23Z")

</div>

Hi Dynatrace Community,

I’m trying to retrieve a list of workloads along with their entity IDs under a specific Kubernetes cluster using the Dynatrace API. I’ve encountered some issues while working with the entity selector, specifically regarding the correct filters to use for workloads.

Here’s what I’ve tried so far:

```auto
params = {
    "entitySelector": (
        "type(KUBERNETES_WORKLOAD),"
        "isClusterOfWorkload(type(KUBERNETES_CLUSTER),entityName.equals(\"{cluster_name}\"))"
    )
}

```

However, I believe that isClusterOfWorkload is not the correct filter. Could anyone please guide me on which entity selector I should use to get the workloads associated with a particular cluster?

Thanks in advance for your help!

---

<div class="post-metadata">

**Author:** ![mark\_bley](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mark_bley/32/20954_2.png) [@mark\_bley](https://community.dynatrace.com/u/mark_bley)\
**Post date:** [November 7, 2024, 7:15pm UTC](https://community.dynatrace.com/t/how-to-list-workloads-with-entity-id-under-the-cluster-name-using-dynatrace-api/48404/2 "2024-11-07T19:15:24Z")

</div>

Kubernetes workload have the type of&nbsp;CLOUD\_APPLICATION and the relationship to a cluster of isClusterOfCa.

Try following selector:

```markup
type(cloud_application),toRelationships.isClusterOfCa(type(kubernetes_cluster),entityName.equals(<k8_cluster_name>))

```

---

<div class="post-metadata">

**Author:** ![Peter\_Youssef](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/peter_youssef/32/14668_2.png) [@Peter\_Youssef](https://community.dynatrace.com/u/Peter_Youssef)\
**Post date:** [November 8, 2024, 6:16am UTC](https://community.dynatrace.com/t/how-to-list-workloads-with-entity-id-under-the-cluster-name-using-dynatrace-api/48404/3 "2024-11-08T06:16:34Z")

</div>

Hello&nbsp;[@vignesh179](https://community.dynatrace.com/user/81607)

In addition to the response provided by&nbsp;[@mark\_bley](https://community.dynatrace.com/user/13072)

PFA similar case

- [https://community.dynatrace.com/t5/Container-platforms/Tagging-Kubernetes-Clusters-Workloads-and-Pods/td-p/201159](https://community.dynatrace.com/topic/201159)

using entity selector guidance:

- [Environment API v2 - Entity selector — Dynatrace Docs](https://docs.dynatrace.com/docs/dynatrace-api/environment-api/entity-v2/entity-selector)

BR,

Peter
