# Tags applied by Kubernetes??

**URL:** <https://community.dynatrace.com/t/tags-applied-by-kubernetes/19941>\
**Category:** Container platforms\
**Tags:** tagging, kubernetes\
**Created:** [July 30, 2020, 7:39pm UTC](https://community.dynatrace.com/t/tags-applied-by-kubernetes/19941 "2020-07-30T19:39:12Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![jordan\_rose](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@jordan\_rose](https://community.dynatrace.com/u/jordan_rose)\
**Post date:** [July 30, 2020, 7:39pm UTC](https://community.dynatrace.com/t/tags-applied-by-kubernetes/19941/1 "2020-07-30T19:39:12Z")

</div>

Notice below that some of our tags are “applied by kubernetes”. We cannot figure how this is done and are looking for insight. Can someone point me in the right direction to find out how these tags are applied by kubernetes.

 ![1596137847674.png](https://global.discourse-cdn.com/dynatrace/original/3X/1/a/1a29d281ad42680d1b049cdf7dafba2ed7fc8b24.png)

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [July 30, 2020, 8:24pm UTC](https://community.dynatrace.com/t/tags-applied-by-kubernetes/19941/2 "2020-07-30T20:24:44Z")

</div>

These are tags that you have imported from Kubernetes. Hence why it has [Kubernetes] in brackets. You can see more of an explanation here: [https://www.dynatrace.com/support/help/technology-support/cloud-platforms/kubernetes/other-deployments-and-configurations/leverage-tags-defined-in-kubernetes-deployments/](https://www.dynatrace.com/support/help/technology-support/cloud-platforms/kubernetes/other-deployments-and-configurations/leverage-tags-defined-in-kubernetes-deployments/)

---

<div class="post-metadata">

**Author:** ![jordan\_rose](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@jordan\_rose](https://community.dynatrace.com/u/jordan_rose)\
**Post date:** [July 30, 2020, 8:41pm UTC](https://community.dynatrace.com/t/tags-applied-by-kubernetes/19941/3 "2020-07-30T20:41:14Z")

</div>

Thanks for the response. I guess I’m missing something still though. I don’t see where the doc mentions these tags being imported or created without an automated tagging rule in Dynatrace

---

<div class="post-metadata">

**Author:** ![dave\_mauney](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dave_mauney/32/27784_2.png) [@dave\_mauney](https://community.dynatrace.com/u/dave_mauney)\
**Post date:** [July 30, 2020, 9:28pm UTC](https://community.dynatrace.com/t/tags-applied-by-kubernetes/19941/4 "2020-07-30T21:28:44Z")

</div>

Line 1: “Dynatrace automatically derives tags from your Kubernetes/OpenShift labels.”

So, do you recognize these as Kubernetes labels defined in your k8s?

---

<div class="post-metadata">

**Author:** ![jordan\_rose](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@jordan\_rose](https://community.dynatrace.com/u/jordan_rose)\
**Post date:** [July 30, 2020, 9:54pm UTC](https://community.dynatrace.com/t/tags-applied-by-kubernetes/19941/5 "2020-07-30T21:54:43Z")

</div>

Ahh right there at the top, I see it now. I will ask the Kubernetes admin about it thank you…

---

<div class="post-metadata">

**Author:** ![Radu](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/radu/32/23351_2.png) [@Radu](https://community.dynatrace.com/u/Radu)\
**Post date:** [July 31, 2020, 7:39am UTC](https://community.dynatrace.com/t/tags-applied-by-kubernetes/19941/6 "2020-07-31T07:39:16Z")

</div>

Hi Jordan,

The OneAgent will use the Kuberentes REST API to read all the metadata at deployment time. So as long as the service accounts under which the pods are running are given view access (via rolebinding or clusterrolebinding objects) they are able to read labels and annotations and translate them automaticallly intro Dynatrace tags and metadata. Your labels will appear as tags with the [Kubernetes] context, whereas annotations will appear as custom metadata at the Process-level in Dynatrace.

The command you see at the at the bottom of the [docs page](https://www.dynatrace.com/support/help/technology-support/cloud-platforms/kubernetes/other-deployments-and-configurations/leverage-tags-defined-in-kubernetes-deployments/?_ga=2.254306440.1623712056.1596034976-1820033307.1594890160) is a generic one that can be used to give the viewer role to all default service accounts in a namespace. This works in most cases, but it will have to be tailored if non-default service accounts are used for any of the pods.

Best regards,

Radu

---

<div class="post-metadata">

**Author:** ![jordan\_rose](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@jordan\_rose](https://community.dynatrace.com/u/jordan_rose)\
**Post date:** [July 31, 2020, 12:09pm UTC](https://community.dynatrace.com/t/tags-applied-by-kubernetes/19941/7 "2020-07-31T12:09:13Z")

</div>

Thank you for the answer…

---

<div class="post-metadata">

**Author:** ![gmichels](https://avatars.discourse-cdn.com/v4/letter/g/6de8d8/32.png) [@gmichels](https://community.dynatrace.com/u/gmichels)\
**Post date:** [September 24, 2020, 5:22pm UTC](https://community.dynatrace.com/t/tags-applied-by-kubernetes/19941/8 "2020-09-24T17:22:31Z")

</div>

Hey

> as long as the service accounts under which the pods are running are given view access

Can you clarify which pods? The OneAgent pods? Or all application pods?

Thanks

---

<div class="post-metadata">

**Author:** ![steventorrestam](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@steventorrestam](https://community.dynatrace.com/u/steventorrestam)\
**Post date:** [August 30, 2023, 3:13pm UTC](https://community.dynatrace.com/t/tags-applied-by-kubernetes/19941/9 "2023-08-30T15:13:13Z")

</div>

Hello, is this still possible and if so, can you report the link in your comment. It seems to go to a 404 page.

---

<div class="post-metadata">

**Author:** ![asant257](https://avatars.discourse-cdn.com/v4/letter/a/53a042/32.png) [@asant257](https://community.dynatrace.com/u/asant257)\
**Post date:** [April 24, 2024, 12:57pm UTC](https://community.dynatrace.com/t/tags-applied-by-kubernetes/19941/10 "2024-04-24T12:57:51Z")

</div>

I do see 404 error

---

<div class="post-metadata">

**Author:** ![BenjaminGT](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@BenjaminGT](https://community.dynatrace.com/u/BenjaminGT)\
**Post date:** [April 24, 2024, 6:30pm UTC](https://community.dynatrace.com/t/tags-applied-by-kubernetes/19941/11 "2024-04-24T18:30:02Z")

</div>

I think this is the replacement page:

> **[Organize Kubernetes/OpenShift deployments by tags](https://docs.dynatrace.com/docs/observe/infrastructure-observability/container-platform-monitoring/kubernetes-monitoring/leverage-tags-defined-in-kubernetes-deployments)**
>
> Organize and filter your monitored applications by importing labels and annotations from your Kubernetes/OpenShift environment.

We may have a way to do this at a cluster level, rather than per namespace/account pair:

kind: ClusterRole  
apiVersion: [rbac.authorization.k8s.io/v1](http://rbac.authorization.k8s.io/v1)  
metadata:  
name: dynatrace-oneagent-metadata-viewer  
rules:  
- apiGroups: [“”]  
resources: [“pods”]  
verbs: [“get”]  
---  
kind: ClusterRoleBinding  
apiVersion: [rbac.authorization.k8s.io/v1](http://rbac.authorization.k8s.io/v1)  
metadata:  
name: dynatrace-oneagent-metadata-viewer-binding  
subjects:  
- kind: Group  
**name: system:serviceaccounts**  
apiGroup: “”  
roleRef:  
kind: ClusterRole  
name: dynatrace-oneagent-metadata-viewer  
apiGroup: “”

We just made sure to have the subjects include a list of groups (such as the built-in system:serviceaccounts one above)

---

<div class="post-metadata">

**Author:** ![netfreq](https://avatars.discourse-cdn.com/v4/letter/n/e9bcb4/32.png) [@netfreq](https://community.dynatrace.com/u/netfreq)\
**Post date:** [April 25, 2024, 4:25pm UTC](https://community.dynatrace.com/t/tags-applied-by-kubernetes/19941/12 "2024-04-25T16:25:47Z")

</div>

I know the Dynatrace docs state "As a result, Kubernetes processes monitored in your Dynatrace environment will have Kubernetes labels attached as Kubernetes tags. For namespaces, pods, and workloads, Kubernetes tags are not evaluated.“As a result, Kubernetes&nbsp;processes&nbsp;monitored in your Dynatrace environment will have Kubernetes labels attached as Kubernetes tags. For namespaces, pods, and workloads, Kubernetes tags are not evaluated.” for this “solution” if someone finds a way we can use it to apply labels to containers/pods, deployments, services and namespaces (to ingest lables the to make available in Dynatrace as tags… I would be forever in your debt… We have been trying for just over a year to get this to work… We just want when a deployment or namespace crosses some threshold, when it throws an alert we can have tags attached to the CIs for we can do things like Pager Duty Orchestration to route the alert to the right teams, service now bucket, ms teams notification, PD alert group… etc etc… we were able to get the k8s labels to populate Dynatrace Ownership, and this is great… but ts GUI only, you cant use any of the ownership data (or even that label) in DT for 3rd party alerting.If you have Dynatrace SaaS and are using the cloud agent to monitor k8s (in aws( ping me… maybe I can help set up a 15-30min test to see if SaaS fixes this… but our company is hung up still uing Managed with full stack One Agent clients.&nbsp; 😞Thanks all!!-John Sweeney 904-885-1666

> **[Organize Kubernetes/OpenShift deployments by tags](https://docs.dynatrace.com/docs/observe/infrastructure-observability/container-platform-monitoring/kubernetes-monitoring/leverage-tags-defined-in-kubernetes-deployments)**
>
> Organize and filter your monitored applications by importing labels and annotations from your Kubernetes/OpenShift environment.
