# Tag Kubernetes Clusters, Workloads, and Pods in Dynatrace for Better Monitoring

**URL:** <https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817>\
**Category:** Container platforms\
**Tags:** tagging, kubernetes\
**Created:** [December 28, 2022, 3:46pm UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817 "2022-12-28T15:46:32Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [April 21, 2024, 10:20pm UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/21 "2024-04-21T22:20:55Z")

</div>

please let me know if they are working ok of is something missing.&nbsp;:+1:

---

<div class="post-metadata">

**Author:** ![Babar\_Qayyum](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/babar_qayyum/32/13620_2.png) [@Babar\_Qayyum](https://community.dynatrace.com/u/Babar_Qayyum)\
**Post date:** [April 22, 2024, 5:04am UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/22 "2024-04-22T05:04:24Z")

</div>

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

First of all, thank you for all your support.Do we need to configure the following rules to make a management zone for a particular namespace?

- type(KUBERNETES\_CLUSTER),entityName.in(“\<YOUR KUBERNETES CLUSTER NAME\>”) type(CLOUD\_APPLICATION\_NAMESPACE),toRelationships.isClusterOfNamespace(type(KUBERNETES\_CLUSTER),entityName.in(“\<YOUR KUBERNETES CLUSTER NAME\>”))
- Dimensional rule for METRIC where DIMESION k8s.cluster.name equals YOUR CLUSTER NAME

The following rules have an issue with the relationship.

- type(CONTAINER\_GROUP\_INSTANCE),toRelationships.isCgiOfNamespace(type(CLOUD\_APPLICATION\_NAMESPACE),entityName.in(“XYZ”))  
**entitySelector The entitySelector has an invalid relationship defined:** CLOUD\_APPLICATION\_NAMESPACE IS\_CGI\_OF\_NAMESPACE CONTAINER\_GROUP\_INSTANCE
- type(PROCESS\_GROUP\_INSTANCE),fromRelationships.isMainPgiOfCgi(type(CONTAINER\_GROUP\_INSTANCE),toRelationships.isCgiOfNamespace(type(CLOUD\_APPLICATION\_NAMESPACE),entityName.in(“XYZ”)))  
**entitySelector The entitySelector has an invalid relationship defined:** CLOUD\_APPLICATION\_NAMESPACE IS\_CGI\_OF\_NAMESPACE CONTAINER\_GROUP\_INSTANCE

Also, the user has a 403 permission issue while accessing the CPU-limit quota saturation of the namespace. Will the above/or missing rules cover this as well?

Regards,

Babar

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [April 22, 2024, 8:28pm UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/23 "2024-04-22T20:28:47Z")

</div>

Hi&nbsp;[@Babar\_Qayyum](https://community.dynatrace.com/user/22017)&nbsp;let me replicate the rules in my environment and I reach you.

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [April 22, 2024, 10:48pm UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/24 "2024-04-22T22:48:38Z")

</div>

Now, for the user to enter to the section of Anomaly detection of the namespace, it must have the following policy:

```markup
ALLOW settings:objects:read, settings:objects:write, settings:schemas:read
WHERE settings:schemaId = "builtin:anomaly-detection.kubernetes.namespace";

```

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [April 22, 2024, 10:55pm UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/25 "2024-04-22T22:55:42Z")

</div>

![DanielS_0-1713826371392.png](https://global.discourse-cdn.com/dynatrace/original/3X/7/d/7def4287d71255edbfec693ec47552a55b527393.png)

Look here [@Babar\_Qayyum](https://community.dynatrace.com/user/22017), if you try to access it through the Kubernetes menu, you won’t see anything, but in Kubernetes Workloads menu you will only see the namespace with the entity ID that you use in the rules.

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [April 22, 2024, 10:59pm UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/26 "2024-04-22T22:59:46Z")

</div>

Sorry I didn’t have time to test it yesterday, but today I tested everything in my environment. Do not hesitate to contact me. Please let me know if the rules worked for you. I edited my previous answer to prevent incorrect rules from confusing anyone.

---

<div class="post-metadata">

**Author:** ![Babar\_Qayyum](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/babar_qayyum/32/13620_2.png) [@Babar\_Qayyum](https://community.dynatrace.com/u/Babar_Qayyum)\
**Post date:** [April 23, 2024, 5:02am UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/27 "2024-04-23T05:02:11Z")

</div>

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

Once again, thank&nbsp; you for all your great support. Mostly, things worked as expected.&nbsp;I faced a challenge with the following rule while applying the automatic tagging.

type(CLOUD\_APPLICATION\_INSTANCE),toRelationships.isNamespaceOfCai(type(CLOUD\_APPLICATION\_NAMESPACE),entityId(“CLOUD\_APPLICATION\_NAMESPACE-XXXXXXXXXXXXX”))  
**entitySelector Entity selector contains type which does not support automatically applied tags**

What about the Dimensional rule for METRIC? Do we need to include it in the management zone? What should be the dimension keys in case they are required?

Regards,

Babar

---

<div class="post-metadata">

**Author:** ![Babar\_Qayyum](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/babar_qayyum/32/13620_2.png) [@Babar\_Qayyum](https://community.dynatrace.com/u/Babar_Qayyum)\
**Post date:** [April 23, 2024, 5:21am UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/28 "2024-04-23T05:21:13Z")

</div>

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

Will the policy apply on the environmental/or management zones level?&nbsp;How can it be assigned only to an individual management zone?

Regards,

Babar

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [April 23, 2024, 3:19pm UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/29 "2024-04-23T15:19:27Z")

</div>

Hello, your welcome&nbsp;[@Babar\_Qayyum](https://community.dynatrace.com/user/22017)&nbsp;&nbsp;you are not doing anything wrong and is not an error, as you can see in this [post](https://community.dynatrace.com/post/233755)&nbsp; auto-tags for type&nbsp;CLOUD\_APPLICATION\_INSTANCE is not supported&nbsp;due to performance implications.

From the test in my environment I&nbsp;didn’t require the DIMENSIONAL Metric, but that depends on what kind of permissions you want to give to the user.

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [April 23, 2024, 3:28pm UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/30 "2024-04-23T15:28:27Z")

</div>

You apply the policy under the environment but you give the group a Permission under the MZ only.

---

<div class="post-metadata">

**Author:** ![Babar\_Qayyum](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/babar_qayyum/32/13620_2.png) [@Babar\_Qayyum](https://community.dynatrace.com/u/Babar_Qayyum)\
**Post date:** [April 24, 2024, 4:14am UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/31 "2024-04-24T04:14:24Z")

</div>

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

Thank you for sharing the post. In the post, it is mentioned that we can apply the&nbsp;manual tag on the Pods level, whereas, I do not see this option in the settings except for the&nbsp;Container.

Regards,

Babar

---

<div class="post-metadata">

**Author:** ![Babar\_Qayyum](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/babar_qayyum/32/13620_2.png) [@Babar\_Qayyum](https://community.dynatrace.com/u/Babar_Qayyum)\
**Post date:** [May 12, 2024, 5:41am UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/32 "2024-05-12T05:41:37Z")

</div>

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

What is the entity selector rule to associate the Kubernetes node with a specific Namespace/Pods?

Regards,

Babar

---

<div class="post-metadata">

**Author:** ![gustavodutra](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/gustavodutra/32/35020_2.png) [@gustavodutra](https://community.dynatrace.com/u/gustavodutra)\
**Post date:** [July 29, 2024, 8:35pm UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/33 "2024-07-29T20:35:17Z")

</div>

Hey guys.

All good?

Unfortunately, it is only possible to add tags to pods manually through the Dynatrace API.

Something that should be simple, but unfortunately it isn’t (it could be easier).

I managed it as follows:

**curl -L -X POST ‘https://{environmentid}.live.dynatrace.com/api/v2/tags?entitySelector=type%28CLOUD\_APPLICATION\_INSTANCE%29%2CtoRelationships.isClusterOfCai%28type%28KUBERNETES\_CLUSTER%29%2CentityName.in%28%22{_YOUR\_CLUSTER\_NAME\_HERE_}%22%29%29’ \**  
**-H ‘Authorization: Api-Token {_YOUR\_API\_TOKEN\_HERE_}’ \**  
**-H ‘Content-Type: application/json’ \**  
**--data-raw '{**  
**“tags”: [**  
**{**  
**“key”: “{_YOUR\_TAG\_HERE_}”**  
**}**  
**]**  
**}’**

Entities.write token required, this cURL is based on the CMD.

Now I need to try to create a management zone based on these manual tags.

---

<div class="post-metadata">

**Author:** ![heramb\_sawant](https://avatars.discourse-cdn.com/v4/letter/h/c4cdca/32.png) [@heramb\_sawant](https://community.dynatrace.com/u/heramb_sawant)\
**Post date:** [August 14, 2024, 3:53pm UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/34 "2024-08-14T15:53:52Z")

</div>

Hi,  
I want to add tags to workload, How can I doo that .I want to have tags lik app name , k8s cluster name&nbsp; to each workload. Can someone&nbsp; tell , if this is possible and how&nbsp; to do that.

Regards,  
Heramb Sawant

---

<div class="post-metadata">

**Author:** ![gustavodutra](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/gustavodutra/32/35020_2.png) [@gustavodutra](https://community.dynatrace.com/u/gustavodutra)\
**Post date:** [August 20, 2024, 1:32pm UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/35 "2024-08-20T13:32:14Z")

</div>

Yes, you can do that. To better understand your request, you want to include tags with the name of your application and the name of the cluster in workloads, right? If so, you can do this in several ways. For example:

Using the following expression:

_type(CLOUD\_APPLICATION),entityId(“CLOUD\_APPLICATION-{YOUR WORKLOAD ID}”)_

This expression will automatically set a tag for all workloads (Cloud Application) with the IDs specified within the braces after entityId.

Here is a visual example I used in my case:

 ![gustavodutra_2-1724160636613.png](https://global.discourse-cdn.com/dynatrace/original/2X/a/a48da53b0e6421bb66d1db145fa2e41313029e77.png)

This documentation shows the types of selectors you can use in an expression.

---

<div class="post-metadata">

**Author:** ![Gabor](https://avatars.discourse-cdn.com/v4/letter/g/8797f3/32.png) [@Gabor](https://community.dynatrace.com/u/Gabor)\
**Post date:** [May 15, 2025, 8:15am UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/36 "2025-05-15T08:15:21Z")

</div>

Hi guys,

Thank you for this thread.

Quick question here, we run a managed environment, and I am trying to tag all services, processes, workloads, pods running on an AWS EKS cluster based on cluster name e.g. or I have already created the management zone for it and I’d use that.

Is it possible to do it via auto tags?

It does not allow me to use types in the entity selector, and I am not able to use the names of the workloads as the k8s clusters I am trying to tag are running many different applications in hundreds of pods/workloads, and I am trying to add a general tag to all running on the selected cluster.

Is it possible some way?

Thanks!

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [May 15, 2025, 4:29pm UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/37 "2025-05-15T16:29:57Z")

</div>

Hi[@Gabor](https://community.dynatrace.com/user/72686) I wrote a lot of posts here helping to make auto tags, there is a series of them using the Kubernetes Cluster name. I think that might help you to achieve what you want.

---

<div class="post-metadata">

**Author:** ![Gabor](https://avatars.discourse-cdn.com/v4/letter/g/8797f3/32.png) [@Gabor](https://community.dynatrace.com/u/Gabor)\
**Post date:** [May 16, 2025, 7:14am UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/38 "2025-05-16T07:14:17Z")

</div>

[@DanielS](https://community.dynatrace.com/user/35788)&nbsp;Thanks!

---

<div class="post-metadata">

**Author:** ![HuseynNajafli](https://avatars.discourse-cdn.com/v4/letter/h/53a042/32.png) [@HuseynNajafli](https://community.dynatrace.com/u/HuseynNajafli)\
**Post date:** [September 10, 2025, 1:42pm UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/39 "2025-09-10T13:42:54Z")

</div>

Can I apply this to Kubernetes workloads based on their type? For example, can it return only those with the type Deployments or Pods?

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [September 10, 2025, 2:21pm UTC](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817/40 "2025-09-10T14:21:28Z")

</div>

Yes [@HuseynNajafli](https://community.dynatrace.com/user/93912)&nbsp;, you could use:

```markup
type(CLOUD_APPLICATION),cloudApplicationDeploymentTypes("KUBERNETES_STATEFUL_SET")
type(CLOUD_APPLICATION),cloudApplicationDeploymentTypes("KUBERNETES_DEPLOYMENT")
type(CLOUD_APPLICATION),cloudApplicationDeploymentTypes("KUBERNETES_POD")

```

Hope it helps!!!

[Previous page](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817.md?page=1)

[Next page](https://community.dynatrace.com/t/tag-kubernetes-clusters-workloads-and-pods-in-dynatrace-for-better-monitoring/37817.md?page=3)
