Get kubernetes cluster name form uuid

Hi!, when getting some information from a process group instance  that runs on a pod in a kubernetes cluster, I can get the KUBERNETES_CLUSTER_ID that looks like a UUID:

curl https://{environmentid}.live.dynatrace.com/api/v2/entities/PROCESS_GROUP_INSTANCE-ABCDEFGHI1234567 | jq -r '.properties.metadata[] | select(.key == “KUBERNETES_CLUSTER_ID”)

703de8b4-2bc0-4f31-8303-3507b58d9d8b

But when I try to find to which cluster is related there is no field that can match that UUID:

curl https://{environmentid}.live.dynatrace.com/api/v2/entities?entitySelector=type(KUBERNETES_CLUSTER)’ | jq .

{
  "totalCount": 3,
  "pageSize": 50,
  "entities": [
    {
      "entityId": "KUBERNETES_CLUSTER-A1",
      "type": "KUBERNETES_CLUSTER",
      "displayName": "cluster-1"
    },
    {
      "entityId": "KUBERNETES_CLUSTER-B2",
      "type": "KUBERNETES_CLUSTER",
      "displayName": "cluster-2"
    },
    {
      "entityId": "KUBERNETES_CLUSTER-C3",
      "type": "KUBERNETES_CLUSTER",
      "displayName": "cluster-3"
    }
  ]
}

How can I relate that UUID with some entity that can give me the cluster name?

Thanks!

Johann

Hi Johan,

Try adding ,fromRelationships.isClusterOfPg(type(“PROCESS_GROUP”),entityId(“PROCESS_GROUP-ID”)) on entityselector field

Regards,

Elena.

Hello @johannrenck

You should specify the entity selector based on which the results will be filtered and being included in the Json file and later on can be saved in Excel Sheet.

DT Ref:

You can also refer to the provided guidance by @erh_inetum

Hoping it adds value.

BR,

Peter.

you can use this entity selector to get the full details about the cluster

type(KUBERNETES_CLUSTER),kubernetesClusterId("703de8b4-2bc0-4f31-8303-3507b58d9d8b")

then, under relationships key focus on `toRelationship` and use it in reverse way like the following entitySelector statement

type(process_group_instance),fromRelationship.isMainPgiOfCgi(type(CONTAINER_GROUP_INSTANCE),fromRelationship.isCgiOfCluster(type(KUBERNETES_CLUSTER),kubernetesClusterId("703de8b4-2bc0-4f31-8303-3507b58d9d8b")))

this is if you need to get all process group instances that’s included within your cluster as example

you trace each entity from the relationship in this way like this  [https://{environmentid}.live.dynatrace.com/api/v2/entities/](https://{environmentid}.live.dynatrace.com/api/v2/entities?entitySelector=type(KUBERNETES_CLUSTER)KUBERNETES_CLUSTER-C3 , then check the entity details and to follow the sequence of relationships