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.

Prerequisites

GCP requirements

Dynatrace requirements

  • Create an API token

  • Enable the following permissions for the API token as needed:

    • To ingest metrics: Ingest metrics, Read configuration, Write configuration
    • To ingest logs: Ingest logs
    • To ingest both logs and metrics: Ingest logs, Ingest metrics, Read configuration, Write configuration
  • 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: 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:
  1. Configure Logs Export to send 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.

  1. Configure ActiveGate for generic log ingestion.

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
  1. 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.

Parameters

Parameter name Description Requirement by deployment type Default value
gcpProjectId The GCP project ID where the Dynatrace GCP function should be deployed. For 'logs' and 'all' deployments, use the GCP project of log Sink Pub/Sub subscription. See Set up generic log ingestion for details. metrics, logs, all optional Your current project ID
deploymentType The solution you want to deploy: 'metrics', 'logs', 'all'. metrics, logs, all optional all
dynatraceAccessKey Your Dynatrace API token with the required permissions according to your selected deployment. See Dynatrace requirements for details. metrics, logs, all required
dynatraceLogIngestUrl Your ActiveGate endpoint used to ingest logs to Dynatrace. See Dynatrace requirements for details. metrics, logs, all required
logsSubscriptionId The ID of your log Sink Pub/Sub subscription. See Set up generic log ingestion for details. logs, all required
dynatraceUrl Your Dynatrace environment endpoint. See Dynatrace requirements for details. metrics, all required
requireValidCertificate If set to true, Dynatrace requires the SSL certificate of your Dynatrace environment. metrics, logs, all optional true
selfMonitoringEnabled Send custom metrics to GCP to diagnose quickly if dynatrace-gcp-function processes and sends metrics/logs to Dynatrace. properly. metrics, logs, all optional false
dockerImage Dynatrace GCP function docker image. We recommend using the default value, but you can adapt it if needed. metrics, logs, all optional dynatrace/dynatrace-gcp-function
logIngestContentMaxLength The maximum content length of a log event. Should be the same as or lower than the setting on your Dynatrace environment. logs, all optional 8192
logIngestAttributeValueMaxLength The maximum length of the log event attribute value. If it exceeds server limit, content will be truncated. logs, all optional 250
logIngestRequestMaxEvents The maximum number of log events in single payload to the logs ingestion endpoint. If it exceeds the server limit, payload will be rejected with code 413. logs, all optional 5000
logIngestRequestMaxSize The maximum size in bytes of a single payload to the logs ingestion endpoint. If it exceeds the server limit, payload will be rejected with code 413. logs, all optional 1048576
logIngestEventMaxAgeSeconds Determines the maximum age of a forwarded log event. Should be the same as or lower than the setting on your Dynatrace environment. logs, all optional 86400
printMetricIngestInput If set to true, the function outputs the lines of metrics into stdout. metrics, all optional false
serviceUsageBooking Service usage booking is used for metrics and determines a caller-specified project for quota and billing purposes. If set to source, monitoring API calls are booked in the project where the Kubernetes container is running. If set to destination, monitoring API calls are booked in the project which is monitored. See Monitor multiple GCP projects - Step 4 for details. metrics, all optional source
useProxy Depending on the value you set for this flag, the function will use the following proxy settings: Dynatrace (set to DT_ONLY), GCP API (set to GCP_ONLY), or both (set to ALL). metrics, all optional By default, proxy settings won't be used.
httpProxy The proxy HTTP address; use this flag in conjunction with USE_PROXY. metrics, all optional
httpsProxy The proxy HTTPS address; use this flag in conjunction with USE_PROXY. metrics, all optional
importDashboards Import predefined dashboards for selected services. metrics, all optional true
importAlerts Import predefined alerting rules for selected services. metrics, all optional true
gcpServicesYaml Configuration file for GCP services. metrics, all optional Uncommented services in the gcpServiceYaml section from values.yaml
  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:

Note: 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>]

View metrics and/or logs

After deploying the integration, depending on your deployment (metric ingest, log ingest or both), you can:

  • See metrics from monitored services in Dynatrace (go to Analyze > Metrics).
  • View and analyze GCP logs in Dynatrace (go to Analyze > Logs). To look for GCP logs, filter by cloud.provider: gcp.

log-gcp

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 must upgrade your helm release.

Upgrade helm

To upgrade your helm release

  1. Find out what release version you're using.
helm ls -n dynatrace
  1. 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
  1. Uninstall the release.

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

helm uninstall <release-name> -n dynatrace
  1. Edit deploymentType in values.yaml with the new value.
  2. Save your configuration.
  3. Run the deployment command again. See Install - step 3 for details.