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

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:

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!

Kubernetes workload have the type of CLOUD_APPLICATION and the relationship to a cluster of isClusterOfCa.

Try following selector:

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

Hello @vignesh179

In addition to the response provided by @mark_bley

PFA similar case

using entity selector guidance:

BR,

Peter