January 4, 2018: For the latest updates to this post, please see Can I automatically apply tags to my OpenShift/Kubernetes application components?
Dynatrace recently introduced a powerful feature that allows you to apply tags to processes and hosts based on environment variable injection. We’re happy to announce that we’ve further enhanced this functionality. Dynatrace now allows you to automatically derive tags from your Red Hat OpenShift environment. This enables you to automatically organize and filter all monitored OpenShift application components.
Define your OpenShift labels
You can specify OpenShift labels in the Pod object definition of your application or you can update the labels of your OpenShift resources using the command
oc label. Dynatrace automatically detects all labels attached to pods at application deployment time. All you have to do is grant sufficient privileges to read these metadata from the OpenShift masters’ REST API:
- In your project, create a service account named
oc create serviceaccount dynatrace
- Allow the
dynatraceservice account to view your project’s metadata via the OpenShift masters’ REST API:
oc policy add-role-to-user view -z dynatrace
- Add the
dynatraceservice account to your application’s pod deployment.
Your OpenShift labels will be automatically attached as Kubernetes tags to all monitored OpenShift processes in your Dynatrace environment (see example below).
Note: As OpenShift is based on Docker and Kubernetes, Dynatrace also detects selected Kubernetes properties which can be used when specifying automated rule-based tags or property-based process group detection rules:
- Kubernetes base pod name: user-provided name of the pod the container belongs to
- Kubernetes container: name of the container that runs the process
- Kubernetes full pod name: full name of the pod the container belongs to
- Kubernetes namespace: namespace to which the containerized process is assigned to
- Kubernetes pod UID: unique ID of the related pod
Leverage Kubernetes tags in Dynatrace
Kubernetes tags are searchable via Dynatrace search. This allows you to easily find and inspect the monitoring results of related processes running in your Red Hat OpenShift environment. You can also leverage OpenShift tags to set up fine-grained alerting profiles. Kubernetes tags also integrate perfectly with Dynatrace filters. For example, you can easily filter technologies or problems based on your Kubernetes tags, as shown below.
We’re currently working on broadening our support for automatically applied Kubernetes tags (for example, to also cover your monitored OpenShift hosts). Additionally, Dynatrace will soon be able to retrieve annotations from the OpenShift masters’ REST API, so stay tuned for updates.
Note: This feature requires OneAgent version 1.127 or above.