# Get kubernetes cluster name form uuid

**URL:** <https://community.dynatrace.com/t/get-kubernetes-cluster-name-form-uuid/48546>\
**Category:** Dynatrace API\
**Tags:** kubernetes, dynatrace-api\
**Created:** [October 24, 2024, 3:23pm UTC](https://community.dynatrace.com/t/get-kubernetes-cluster-name-form-uuid/48546 "2024-10-24T15:23:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johannrenck](https://avatars.discourse-cdn.com/v4/letter/j/f6c823/32.png) [@johannrenck](https://community.dynatrace.com/u/johannrenck)\
**Post date:** [October 24, 2024, 3:23pm UTC](https://community.dynatrace.com/t/get-kubernetes-cluster-name-form-uuid/48546/1 "2024-10-24T15:23:40Z")

</div>

Hi!, when getting some information from a process group instance&nbsp; that runs on a pod in a kubernetes cluster, I can get the&nbsp;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”)

```markup
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 .

```javascript
{
  "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

---

<div class="post-metadata">

**Author:** ![erh\_inetum](https://avatars.discourse-cdn.com/v4/letter/e/48db29/32.png) [@erh\_inetum](https://community.dynatrace.com/u/erh_inetum)\
**Post date:** [October 25, 2024, 5:46am UTC](https://community.dynatrace.com/t/get-kubernetes-cluster-name-form-uuid/48546/2 "2024-10-25T05:46:29Z")

</div>

Hi Johan,

Try adding **,fromRelationships.isClusterOfPg(type(“PROCESS\_GROUP”),entityId(“PROCESS\_GROUP-ID”))** on entityselector field

Regards,

Elena.

---

<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:** [October 25, 2024, 6:29am UTC](https://community.dynatrace.com/t/get-kubernetes-cluster-name-form-uuid/48546/3 "2024-10-25T06:29:09Z")

</div>

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

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.

 ![2024-10-25_10h23_45.png](https://global.discourse-cdn.com/dynatrace/original/3X/c/1/c1beaca7bda4cb192f5bef3b99b7416f80575b33.png)

**DT Ref:**

- [Monitored entities API - GET entity type — Dynatrace Docs](https://docs.dynatrace.com/docs/dynatrace-api/environment-api/entity-v2/get-entity-type)

You can also refer to the provided guidance by&nbsp;[@erh\_inetum](https://community.dynatrace.com/user/40722)

Hoping it adds value.

BR,

Peter.

---

<div class="post-metadata">

**Author:** ![MostafaHussein](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mostafahussein/32/2785_2.png) [@MostafaHussein](https://community.dynatrace.com/u/MostafaHussein)\
**Post date:** [October 25, 2024, 9:37am UTC](https://community.dynatrace.com/t/get-kubernetes-cluster-name-form-uuid/48546/4 "2024-10-25T09:37:38Z")

</div>

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

```markup
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

```markup
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&nbsp;&nbsp;[https://{environmentid}.live.dynatrace.com/api/v2/entities/](https://{environmentid}.live.dynatrace.com/api/v2/entities?entitySelector=type(KUBERNETES\_CLUSTER)KUBERNETES\_CLUSTER-C3&nbsp;, then check the entity details and to follow the sequence of relationships
