Deploy Dynatrace Operator to monitor your Kubernetes cluster and the applications running on it. Application monitoring is licensed per container-hour as Container Application Monitoring.
With Kubernetes platform monitoring + Application observability deployed, you can use the
Kubernetes app to:
If you’re looking to gain deeper insights into your Kubernetes environment, check out the deployment overview to learn about Full-Stack monitoring, which adds host and VM visibility. You can further extend with Log Analytics, Code Monitoring, Real User Monitoring and Synthetics, and Application Security.
This tutorial is intended for platform engineers, site reliability engineers (SREs), and Kubernetes administrators.
By the end of this tutorial, you'll have Dynatrace monitoring both your Kubernetes cluster and the applications running on it. Along the way, you'll:
Before installing Dynatrace on your Kubernetes cluster, ensure that you meet the following requirements:
kubectl CLI is connected to the Kubernetes cluster that you want to monitor.kubectl or oc commands. If you don't use the cluster-admin cluster role, see deployment permissions for the required permissions.You must allow egress for Dynatrace pods (default: Dynatrace namespace) to your Dynatrace environment URL.
For OpenShift Dedicated, you need the cluster-admin role.
Helm installation Use Helm version 3.
See supported Kubernetes/OpenShift platform versions and distributions.
Container Application Monitoring works on all supported distributions. For setups without Dynatrace Operator and for other platforms, see Monitor container workloads.
If you're deploying to OpenShift, configure SCC before proceeding; it's required for applicationMonitoring deployments with the CSI driver.
Don't combine hostMonitoring and applicationMonitoring in the same cluster. Container Application Monitoring needs application monitoring mode: in a host monitoring mode, OneAgent already licenses each node as a host, so its containers would be licensed twice.
Dynatrace Operator version 1.10+ OneAgent version 1.345+
Kubernetes platform monitoring + Application observability requires a Dynatrace Platform Subscription (DPS) (SaaS).
For more information on included trace and metric volumes per container-hour, see Container Application Monitoring consumption.
Code Monitoring is licensed separately, and Profiling isn't available. For all limitations, see Monitor container workloads. To attribute costs to teams, see cost allocation.
Select the installation method that works best for you: Helm or manifest.
Dynatrace Operator version 1.10+
These instructions use Dynatrace's Helm chart from an OCI registry. If you have the Dynatrace repository in your local Helm repositories, you can remove it before proceeding:
helm repo remove dynatrace
Install Dynatrace Operator
If you're using Helm 4.0+, replace --atomic with --rollback-on-failure in the commands below.
You have two options:
The following command works for both default installations and installations using an OCI registry.
helm install dynatrace-operator oci://public.ecr.aws/dynatrace/dynatrace-operator \--create-namespace \--namespace dynatrace \--atomic
Edit the values.yaml sample from GitHub, and then run the install command, passing the YAML file as an argument:
helm install dynatrace-operator oci://public.ecr.aws/dynatrace/dynatrace-operator \--create-namespace \--namespace dynatrace \--atomic \-f values.yaml
If installCRD is set to false, you need to create the custom resource definition manually before starting the Helm installation:
kubectl apply -f https://github.com/Dynatrace/dynatrace-operator/releases/download/v1.10.2/dynatrace-operator-crd.yaml
VMware Tanzu Kubernetes (TKGI) and IBM Kubernetes Service (IKS) require additional configuration.
Create a secret named dynakube for the Dynatrace Operator token and data ingest token obtained in Tokens and permissions required.
kubectl -n dynatrace create secret generic dynakube \--from-literal="apiToken=<OPERATOR_TOKEN>" \--from-literal="dataIngestToken=<DATA_INGEST_TOKEN>"
Create your DynaKube custom resource YAML file.
For OneAgent workloads, you need the resource attribute only if the tenant-wide setting builtin:billing.container-application-monitoring.optin isn't enabled. It's enabled by default for new customers, so they can leave the attribute out of the DynaKube.
For OpenTelemetry workloads, you always need the resource attribute. The tenant-wide setting covers OneAgent only.
For all opt-in options, see Kubernetes container workloads.
The following sample enables Container Application Monitoring for OneAgent-instrumented containers in namespaces labeled container_application_monitoring-oneagent: "true".
You can review the available parameters or how-to guides and adapt the DynaKube according to your requirements.
apiVersion: dynatrace.com/v1beta6kind: DynaKubemetadata:name: dynakubenamespace: dynatracespec:apiUrl: https://<ENVIRONMENTID>.live.dynatrace.com/apitokens: dynakube# Opt in to Container Application Monitoring billing.# Omit this block if the tenant-wide setting# builtin:billing.container-application-monitoring.optin is already enabled.resourceAttributes:dt.has_container_application_monitoring: "true"oneAgent:applicationMonitoring:namespaceSelector:matchLabels:container_application_monitoring-oneagent: "true" # Adjust to target your namespaces.activeGate:capabilities:- routing- kubernetes-monitoringresources:requests:cpu: 500mmemory: 512Milimits:cpu: 1000mmemory: 1.5Gi
In the following sample, the Operator injects the OTLP exporter settings and the opt-in attribute into pods in namespaces labeled container_application_monitoring-otlp: "true". It also adds k8s.pod.uid and k8s.container.name, which Dynatrace needs to attribute telemetry to a container.
apiVersion: dynatrace.com/v1beta6kind: DynaKubemetadata:name: dynakubenamespace: dynatracespec:apiUrl: https://<ENVIRONMENTID>.live.dynatrace.com/apitokens: dynakube# Opt in to Container Application Monitoring billing (applies to all components).# Required for OTLP workloads regardless of the tenant-wide setting.resourceAttributes:dt.has_container_application_monitoring: "true"# The Operator injects OTLP exporter configuration (endpoint, token,# resource attributes) into pods in the selected namespaces.otlpExporterConfiguration:signals:traces: {}metrics: {}namespaceSelector:matchLabels:container_application_monitoring-otlp: "true" # Adjust to target your namespaces.activeGate:capabilities:- routing- kubernetes-monitoringresources:requests:cpu: 500mmemory: 512Milimits:cpu: 1000mmemory: 1.5Gi
To opt in individual workloads, OpenTelemetry workloads the Operator doesn't manage, or sidecar containers, see Kubernetes container workloads.
Optional Monitor potentially sensitive data
To monitor potentially sensitive data such as Secrets (values are masked before ingest) and ConfigMaps, you need to create a ClusterRole that allows access to these resources. Add the following snippet at the end of your DynaKube custom resource YAML file.
---apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRolemetadata:labels:rbac.dynatrace.com/aggregate-to-monitoring: "true"name: dynatrace-kubernetes-monitoring-sensitiverules:- apiGroups:- ""resources:- configmaps- secretsverbs:- list- watch- get
In Dynatrace Operator version 1.8.x, the role is automatically bound to the dynatrace-kubernetes-monitoring ClusterRole via aggregation rules. For more information, see ClusterRole aggregation documentation. Starting with Dynatrace Operator version 1.9.0, aggregated ClusterRoles are no longer used. Create a ClusterRoleBinding to bind this ClusterRole to the dynatrace-activegate service account directly.
Apply the DynaKube custom resource
Run the command below to apply the DynaKube custom resource, replacing <your-DynaKube-CR> with your file name. A validation webhook will provide helpful error messages if there's a problem.
kubectl apply -f <your-DynaKube-CR>.yaml
Optional Verify deployment
Verify that your DynaKube is running and all pods in your Dynatrace namespace are running and ready.
> kubectl get dynakube -n dynatraceNAME APIURL STATUS AGEdynakube https://<ENVIRONMENTID>.live.dynatrace.com/api Running 45s
In a default DynaKube configuration with CSI driver, you should see the following pods:
> kubectl get pods -n dynatraceNAME READY STATUS RESTARTS AGEdynakube-activegate-0 1/1 Running 0 50sdynatrace-oneagent-csi-driver-qxfwx 4/4 Running 0 2m49sdynatrace-oneagent-csi-driver-xk5c4 4/4 Running 0 2m49sdynatrace-oneagent-csi-driver-mz6ch 4/4 Running 0 2m49sdynatrace-operator-7dc8dc7d8c-wmh4z 1/1 Running 0 2m59sdynatrace-webhook-7bb6957fb5-l8fsq 1/1 Running 0 2m59sdynatrace-webhook-7bb6957fb5-rqnqk 1/1 Running 0 2m59s
Create a dynatrace namespace
kubectl create namespace dynatrace
Install Dynatrace Operator
kubectl apply -f https://github.com/Dynatrace/dynatrace-operator/releases/download/v1.10.2/kubernetes-csi.yaml
kubectl apply -f https://github.com/Dynatrace/dynatrace-operator/releases/download/v1.10.2/kubernetes.yaml
VMware Tanzu Kubernetes (TKGI) and IBM Kubernetes Service (IKS) require additional configuration.
Run the following command to see when Dynatrace Operator components finish initialization:
kubectl -n dynatrace wait pod --for=condition=ready \--selector=app.kubernetes.io/name=dynatrace-operator,app.kubernetes.io/component=webhook \--timeout=300s
Create a secret named dynakube for the Dynatrace Operator token and data ingest token.
kubectl -n dynatrace create secret generic dynakube \--from-literal="apiToken=<OPERATOR_TOKEN>" \--from-literal="dataIngestToken=<DATA_INGEST_TOKEN>"
Create your DynaKube custom resource YAML file.
See the DynaKube samples in the Helm section above for reference configurations for OneAgent and OpenTelemetry deployments. You can review available parameters and how-to guides and adapt the DynaKube to your requirements.
Optional Monitor potentially sensitive data
To monitor potentially sensitive data such as Secrets (values are masked before ingest) and ConfigMaps, you need to create a ClusterRole that allows access to these resources. Add the following snippet at the end of your DynaKube custom resource YAML file.
---apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRolemetadata:labels:rbac.dynatrace.com/aggregate-to-monitoring: "true"name: dynatrace-kubernetes-monitoring-sensitiverules:- apiGroups:- ""resources:- configmaps- secretsverbs:- list- watch- get
In Dynatrace Operator version 1.8.x, the role is automatically bound to the dynatrace-kubernetes-monitoring ClusterRole via aggregation rules. For more information, see ClusterRole aggregation documentation. Starting with Dynatrace Operator version 1.9.0, aggregated ClusterRoles are no longer used. Create a ClusterRoleBinding to bind this ClusterRole to the dynatrace-activegate service account directly.
Apply the DynaKube custom resource
kubectl apply -f <your-DynaKube-CR>.yaml
Optional Verify deployment
> kubectl get dynakube -n dynatraceNAME APIURL STATUS AGEdynakube https://<ENVIRONMENTID>.live.dynatrace.com/api Running 45s
Add a dynatrace project
oc adm new-project --node-selector="" dynatrace
Install Dynatrace Operator
oc apply -f https://github.com/Dynatrace/dynatrace-operator/releases/download/v1.10.2/openshift-csi.yaml
oc apply -f https://github.com/Dynatrace/dynatrace-operator/releases/download/v1.10.2/openshift.yaml
oc -n dynatrace wait pod --for=condition=ready \--selector=app.kubernetes.io/name=dynatrace-operator,app.kubernetes.io/component=webhook \--timeout=300s
Create a secret named dynakube.
oc -n dynatrace create secret generic dynakube \--from-literal="apiToken=<OPERATOR_TOKEN>" \--from-literal="dataIngestToken=<DATA_INGEST_TOKEN>"
Create your DynaKube custom resource YAML file (see the Helm section above for reference samples) and apply it.
oc apply -f <your-DynaKube-CR>.yaml
Optional Verify deployment
> oc get dynakube -n dynatraceNAME APIURL STATUS AGEdynakube https://<ENVIRONMENTID>.live.dynatrace.com/api Running 45s
You've successfully set up Kubernetes platform monitoring and Application observability, billed as Container Application Monitoring. In this tutorial, you:
Monitor and optimize Kubernetes with Dynatrace. Get real-time insights and health for clusters and workloads.
Detailed description of installation and configuration options for specific use-cases
This page will assist you in navigating any challenges you may encounter while working with the Dynatrace Operator and its various components.
In-depth description on how the deployment on Kubernetes works.
Contains a reference page with configuration options for each Dynatrace component
Release notes for Dynatrace Operator
Upgrade paths, update procedures, and uninstallation guide for Dynatrace Operator.
Find CPU and memory resource recommendations for Dynatrace ActiveGates deployed in Kubernetes, sized by cluster scale and workload type.