Deploy ActiveGate in OpenShift as a StatefulSet

Dynatrace Operator manages the lifecycle of several Dynatrace components, including ActiveGate. If you can't use Dynatrace Operator, you can deploy the ActiveGate directly as a StatefulSet. See below for instructions.

Deploy ActiveGate

Prerequisites
  1. Create a dedicated namespace.

    oc adm new-project --node-selector="" dynatrace
    
  2. Create a secret holding the environment URL and login credentials for this registry.

    Example command:

    oc -n dynatrace create secret docker-registry dynatrace-docker-registry --docker-server=<YOUR_ENVIRONMENT_URL> --docker-username=<YOUR_ENVIRONMENT_ID> --docker-password=<YOUR_PAAS_TOKEN> -n dynatrace
    

    where you need to replace

    • <YOUR_ENVIRONMENT_URL> with your environment URL (without 'http'). Example: environment.live.dynatrace.com
    • <YOUR_ENVIRONMENT_ID> with the docker account username (same as the ID in your environment URL above)
    • <YOUR_PAAS_TOKEN> with the PaaS token you created in Prerequisites.
  3. Create a file named ag-monitoring.yaml with the following content, making sure to replace

    • <YOUR_ENVIRONMENT_URL> and <YOUR_ENVIRONMENT_ID> with your own values as described above
    • <ANY_UNIQUE_ID> with any unique value. This ID will be used by the ActiveGate to generate a unique name in the UI.
  4. Deploy ActiveGate.

    oc apply -f ag-monitoring.yaml
    
  5. Set up routing. optional

    To set up OneAgent routing inside OpenShift using ActiveGate as a StatefulSet, create a file named, for example, ag-routing.yaml with the content as in the following example, where

    • <YOUR_ENVIRONMENT_URL> is as described in step 2.
    • <ANY_UNIQUE_ID> is the value you set in step 3.
  6. Save your configuration.

    oc apply -f ag-routing.yaml
    

Connect your OpenShift clusters to Dynatrace

  1. Create a service account and cluster role.

    Create a service account and cluster role for accessing the Kubernetes API. This creates the bearer token necessary to authenticate in the Kubernetes API. Use the following snippet.

    oc apply -f https://www.dynatrace.com/support/help/codefiles/kubernetes/kubernetes-monitoring-service-account.yaml
    
  2. Get the Kubernetes API URL.

    $ oc config view --minify -o jsonpath='{.clusters[0].cluster.server}'
    
  3. Get the bearer token.

    oc get secret $(oc get sa dynatrace-monitoring -o jsonpath='{.secrets[0].name}' -n dynatrace) -o jsonpath='{.data.token}' -n dynatrace | base64 --decode
    
  4. In the Dynatrace menu, go to Settings > Cloud and virtualization > Kubernetes, and select Connect new cluster.

  5. Provide a Name, Kubernetes API URL, and the Bearer token for the OpenShift cluster.

Once you connect your OpenShift clusters to Dynatrace, you can get native Kubernetes metrics, like request limits, and differences in pods requested vs. running pods.