cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

vignesh179
Visitor

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!

2 REPLIES 2

mark_bley
Dynatrace Champion
Dynatrace Champion

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>))

 

Featured Posts