How do I run Dynatrace OneAgent with Kubernetes?

To monitor applications running in Kubernetes clusters, first deploy Dynatrace OneAgent on all Kubernetes nodes (previously known as "minions") by means of a DaemonSet. Subsequently, install Dynatrace OneAgent on the Kubernetes worker nodes, as described on this page.

Before you begin

What you'll need:

  • kubectl CLI

Locate your Dynatrace OneAgent installer URL

The first step is to obtain the location for ONEAGENT_INSTALLER_SCRIPT_URL. This information is presented to you during Dynatrace OneAgent installation.

To get your ONEAGENT_INSTALLER_SCRIPT_URL

  1. Select Deploy Dynatrace from the navigation menu.
  2. Click Start installation and select Linux.
  3. Locate your ONEAGENT_INSTALLER_SCRIPT_URL, as shown below.

Install Dynatrace OneAgent

Deploy Dynatrace OneAgent on Kubernetes nodes.

$ cat <<- EOF > dynatrace-oneagent.yaml
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: dynatrace-oneagent
spec:
  template:
    metadata:
      labels:
        name: dynatrace-oneagent
    spec:
      hostPID: true
      hostIPC: true
      hostNetwork: true
      nodeSelector:
        beta.kubernetes.io/os: linux
      volumes:
      - name: host-root
        hostPath:
          path: /
      containers:
      - name: dynatrace-oneagent
        image: dynatrace/oneagent
        args:
        - "APP_LOG_CONTENT_ACCESS=1"
        env:
        - name: ONEAGENT_INSTALLER_SCRIPT_URL
          value: "REPLACE_WITH_YOUR_URL"
        - name: ONEAGENT_INSTALLER_SKIP_CERT_CHECK
          value: "false"
        volumeMounts:
        - name: host-root
          mountPath: /mnt/root
        securityContext:
          privileged: true
EOF

Be sure to replace REPLACE_WITH_YOUR_URL placeholder in the dynatrace-oneagent.yaml file with the Dynatrace OneAgent installer URL as explained above.

Deploy the DaemonSet

$ kubectl create -f dynatrace-oneagent.yaml

The command above runs Dynatrace OneAgent on all Kubernetes worker nodes. You may also want to run Dynatrace OneAgent on the master nodes. Please use the default Linux installer for this.