Google Container Engine (GKE) is a management and orchestration system for Docker containers and container clusters that run within Google's public cloud services. Google Container Engine is based on Kubernetes, Google's open source container management system.
To deploy OneAgent in GKE-based clusters, follow the instructions below.
What you'll need
Install Google Cloud SDK (there's no need to run
gcloud init). Following installation, open your terminal. Using the gcloud tool, install
kubectlusing the following command:
gcloud components install kubectl
Set the environmental variable
%USERPROFILE%\.kube\config(for Windows) or
Create a new directory
%USERPROFILE%\.kube(for Windows) or
/home/username/.kube/(for Linux) with an empty file
Create your Google Cloud project
Click the arrow button next to the Google Cloud logo.
Click the plus sign button to open a New Project window.
Type a new project name and select Create.
Select your project and click Open.
Note: There's no need to run this procedure more than once; projects can be reused.
Create your Container Engine cluster
Select Container Engine from the sidebar menu.
Click Create a container cluster.
Enter the desired settings. The most important are Size (number of nodes), Node image (
cosimage deploys OS with read-only file system,
container-vmis an ordinary Debian with a r/w file system), Cluster version (version of Kubernetes) and Machine type (keep these settings as low as you can to reduce your monitoring costs).
Click Create. Cluster spawning takes some time. After completion, a green tick mark appears next to the cluster name.
Connect to the deployed Kubernetes cluster
In your terminal, invoke the commands shown in the image below. The second command will prepare a dashboard hosted on your local machine, which will be accessible through the URL appearing at the bottom of the popup window.
Deploy Dynatrace OneAgent in Kubernetes
The GKE cluster must be deployed using the
Container-Optimised OS isn't supported.
Connect to the cluster and open the Kubernetes UI dashboard.
Select Workloads > Deployments from the sidebar menu.
Click CREATE in the upper-right corner of the page.
Select Upload a YAML or JSON file and use the system dialog to upload the YAML file required for the deployment of Dynatrace OneAgent in Kubernetes.
Note: As YAML is indent-sensitive, be careful not to modify the format of the YAML file while copying and pasting it.
apiVersion: extensions/v1beta1 kind: DaemonSet metadata: name: dynatrace-oneagent spec: template: metadata: labels: run: dynatrace-oneagent spec: hostPID: true hostIPC: true hostNetwork: true volumes: - name: host-root hostPath: path: / - name: dynatrace-opt hostPath: path: /var/lib/docker/dynatraceopt containers: - name: dynatrace-oneagent image: dynatrace/oneagent args: - "TENANT=<TENANT>" - "TENANT_TOKEN=<TENANT_TOKEN>" - "SERVER=<SERVER>" volumeMounts: - mountPath: /mnt/root name: host-root - mountPath: /mnt/root/opt name: dynatrace-opt securityContext: privileged: true
Note: Be sure to replace
TENANT_TOKEN in the
containers args with your credentials and replace
SERVER with your connection endpoint.
TENANT represents your
To get your Dynatrace environment ID and token
- Select Deploy Dynatrace from the navigation menu.
- Click Start installation and select Linux.
- Locate your environment ID and token, as shown below.
Your connection endpoint is
If you're using Dynatrace Managed, the connection endpoint for your Managed cluster is
Click Upload and wait for the page to reload. You will be shown a view of the deployed daemon sets and pods. You can look up the deployment event log by clicking the
dynatrace-oneagent-… entry beneath the Pods section.
Once the icon preceding the pod name in the Workloads dashboard changes to a green tick, your OneAgent deployment is completed and OneAgent will be running.
You can view logs of the running container by clicking View logs in your pod dashboard.
Your app will proceed its deployment. You can see your applications on the Daemon Sets page. Virtual hosts are listed on the Pods page.
To connect to a pod, you'll need the pod name. You can look up the name on your Kubernetes dashboard or by invoking
kubectl get pods in the command line. Open your terminal and type:
kubectl exec <pod name> -it -- <command>
kubectl exec pod1-hlbz3 -it -- /bin/sh
This command executes a shell on the selected pod.
To remove a pod, go to the Pods page, open the actions menu (...) of the selected pod and select Delete.
To remove an entire daemon set (app), go to the Daemon Sets page and follow the same steps as for pod removal.
Add collaborators to your Google Cloud project
To grant other users access to your Google Cloud project
- Open the IAM page from the Google Cloud dashboard.
- Go to IAM subpage and click Add.
- Enter the new user’s email address and set an applicable role (for example,
Owner). After a while, the new user will be able to access your project.
More information can be found on the following pages: