Can I automatically apply tags to my OpenShift/Kubernetes application components?

Dynatrace allows you to automatically derive tags from your OpenShift environment. This enables you to automatically organize and filter all your 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:

Select the OpenShift project that hosts your application (assuming foo in the following examples):

$ oc project foo

In this project, create a service account named dynatrace:

$ oc create serviceaccount dynatrace

Allow the dynatrace service account to view metadata about your project via the OpenShift masters' REST API:

$ oc policy add-role-to-user view -z dynatrace

Add the dynatrace service account to the Kubernetes Pod configuration of your application:

kind: DeploymentConfig
apiVersion: v1
      containers: [...]
      serviceAccountName: dynatrace

Your OpenShift labels will be automatically attached as OpenShift tags to all monitored OpenShift processes in your Dynatrace environment (see example below).

Automatic detection of Kubernetes properties

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.
  • Kubernetes pod UID: Unique ID of the related pod.

Leverage OpenShift tags in Dynatrace

OpenShift 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. OpenShift tags also integrate perfectly with Dynatrace filters.