Deploy the Dynatrace integration in Google Kubernetes Engine (GKE)

You can deploy the Dynatrace GCP function in a Kubernetes container to ingest metrics and/or logs.

DDU consumption for Log Monitoring

DDU pricing applies to cloud Log Monitoring. See DDUs for Log Monitoring for details.

Prerequisites

Review the GCP and Dynatrace requirements.

GCP requirements

  • Enable Workload Identity on a cluster

  • Enable GKE_METADATA on the GKE node pools

  • If you're not using Google Cloud Shell, you need to install the following:

  • Connect to your Kubernetes cluster

    To connect to your cluster, run the command below.

    Note: Be sure to replace

    • <cluster> with your cluster name
    • <region> with the region where your cluster is running
    • <project> with the project ID where your cluster is running
    gcloud container clusters get-credentials <cluster> --region <region> --project <project>
    

    See Configuring cluster access for kubectl for details.

    Alternatively, you can connect to your cluster from the GCP console:

    1. In your GCP console, go to your Kubernetes Engine.
    2. Select Clusters, and then select Connect.
    3. Select Run in Cloud Shell.

Dynatrace requirements

Review the requirements for ActiveGate, tokens, and the environment URL.

ActiveGate

For ActiveGate, you have two options:

  • Have the installation script create a dedicated ActiveGate (default option) recommended
  • Use an existing ActiveGate (version 1.213+ required)

Tokens

The requirements for API and PaaS tokens are as follows:

  • Create an API token
  • Enable the following permissions for the API token as needed:
    • To ingest metrics: Ingest metrics (API v2), Read configuration (API v1), Write configuration (API v1)
    • To ingest logs: Ingest logs (API v2)
    • To ingest both logs and metrics: Ingest logs (API v2), Ingest metrics (API v2), Read configuration (API v1), Write configuration (API v1)
  • Create a PaaS token (if you choose to set up a new ActiveGate during deployment)

Environment URL

  • Determine the URL for your environment.

    • For Dynatrace SaaS: https://<your-environment-id>.live.dynatrace.com
    • For Dynatrace Managed: https://<your-domain>/e/<your-environment-id>
    • For ActiveGate (if you choose to use an existing ActiveGate to ingest logs): https://<your-active-gate-IP-or-hostname>:9999/e/<your-environment-id>

    Note: To determine <your-environment-id>, see environment ID.

Set up generic log ingestion optional

Requirements
  • Dynatrace Log Monitoring v2 - required for log ingestion. To enable Dynatrace Log Monitoring v2, contact a Dynatrace ONE product specialist by selecting the chat button in the upper-right corner of the Dynatrace menu bar.

To enable generic log ingestion

  1. Create a Pub/Sub topic and add a subscription it. There are two ways to do this:

  2. Configure Logs Export to send the desired logs to the GCP Pub/Sub topic created in Step 1.

    Note: Be sure to add Sink permission to publish to the Pub/Sub topic.

  3. Configure ActiveGate for generic log ingestion if you choose to set up a new ActiveGate during deployment.

Install

To deploy the Dynatrace GCP function in a Kubernetes container

  1. Download the helm deployment package in Google Cloud Shell.

    wget -q https://github.com/dynatrace-oss/dynatrace-gcp-function/releases/latest/download/helm-deployment-package.tar; tar -xvf helm-deployment-package.tar; chmod +x helm-deployment-package/deploy-helm.sh
    
  2. Set the required values in values.yaml located in helm-deployment-package/dynatrace-gcp-function. You can use the default values or customize them according to your needs. See below for details.

  1. Run the script, which will create an IAM service account with the necessary roles for you. You have two options:
    • Run the script without parameters if you want to use the default values provided (dynatrace-gcp-function-sa for the IAM service account name and dynatrace_function for the IAM role name prefix):
      deploy-helm.sh
      
    • Run the script with parameters if you want to set your own values (be sure to replace the placeholders with your desired values):
      deploy-helm.sh [--service-account <service-account-to-be-created/updated>] [--role-name <role-to-be-created/updated>]
      

Verify installation

To check whether installation was successful

  1. Check if the container is running.

    Note: After the installation, it may take couple of minutes until the container is up and running.

    kubectl -n dynatrace get pods
    
  2. Check the container logs for errors or exceptions. You have two options:

  • For deployments of type 'metrics', run

    kubectl -n dynatrace logs -l app=dynatrace-gcp-function -c dynatrace-gcp-function-metrics
    
  • For deployments of type 'logs', run

    kubectl -n dynatrace logs -l app=dynatrace-gcp-function -c dynatrace-gcp-function-logs
    
  • For deployments of type 'all', run

    kubectl -n dynatrace logs -l app=dynatrace-gcp-function -c dynatrace-gcp-function-metrics
    kubectl -n dynatrace logs -l app=dynatrace-gcp-function -c dynatrace-gcp-function-logs
    
  1. Check if dashboards are imported (for deployments of type 'metrics' or 'all').

    In the Dynatrace menu, go to Dashboards and filter by Tag for Google Cloud. A number of dashboards for Google Cloud Services should be available.

View metrics and/or logs

After deploying the integration, depending on your deployment type, you can:

  • See metrics from monitored services: In the Dynatrace menu, go to Metrics.
  • View and analyze GCP logs: In the Dynatrace menu, go to Logs. To look for GCP logs, filter by cloud.provider: gcp.

log-gcp

Troubleshoot

To investigate potential deployment and connectivity issues, see Troubleshoot Google Cloud Platform monitoring setup.

Update deployment

To change the deployment type, see Update deployment type.

You can update your configuration (for example, add services to Dynatrace monitoring) by editing values.yaml. After editing the file and saving your changes, you need to upgrade your helm release.

Upgrade helm

To upgrade your helm release

  1. Find out what release version you're using.

    helm ls -n dynatrace
    
  2. Run the command below, making sure to replace <your-helm-release> with your helm release version.

    helm upgrade <your-helm-release> dynatrace-gcp-function -n dynatrace
    

See Helm upgrade for details.

Update deployment type

To change the deployment type

  1. Find out what release version you're using.

    helm ls -n dynatrace
    
  2. Uninstall the release.

    Note: Be sure to replace <release-name> with the release name from the previous output.

    helm uninstall <release-name> -n dynatrace
    
  3. Edit deploymentType in values.yaml with the new value.

  4. Save your configuration.

  5. Run the deployment command again. See Install - step 3 for details.