Articles in this section
Category / Section

Dynatrace Log Integration for Bold BI Deployment on OKE

Published:

Step 1 – Create an account in Dynatrace

Use the site to create an account in Dynatrace - https://www.dynatrace.com

After the account creation, you will have an account URL which looks like: https://abc12345.apps.dynatrace.com

Step 2 - Create Required Tokens in Dynatrace

We need to generate 2 tokens – Operator token and Data Ingest token

Documentation reference for generating tokens - Access tokens and permissions — Dynatrace Docs

  • Go to Settings > Access tokens (or search for “Access tokens”)
  • Select Generate new token
  • Provide a meaningful name for the token
  • Enable the required permissions for the token.
    For the Operator token, select the template in Template > Kubernetes: Dynatrace Operator. This will automatically add the required scopes.
    For the Data Ingest token, select the template in Template > Kubernetes: Data Ingest. This will automatically add the required scopes.
  • Select Generate token to create the token
  • Ensure to copy the token and store it in a secure place

Step 3 – Form the API URL

You can form the API URL with your account by adding ‘/api’ in the end and replace ‘apps’ with ‘live’

Example, If your account is https://abc12345.apps.dynatrace.com, then the API URL will be like below

API URL: https://abc12345.live.dynatrace.com/api

Step 4 – Deploy Dynatrace on the OKE cluster

Install the Dynatrace Operator from the OCI registry:

If helm version 3 run below command

helm install dynatrace-operator oci://public.ecr.aws/dynatrace/dynatrace-operator --create-namespace --namespace dynatrace --atomic 

If helm version 4 then run below

helm install dynatrace-operator oci://public.ecr.aws/dynatrace/dynatrace-operator --create-namespace --namespace dynatrace --rollback-on-failure --wait --timeout 10m 

image.png

Store your tokens securely in a Kubernetes secret:

You need to use the Operator token and the Data Ingest token that you have generated in the Step 2

kubectl -n dynatrace create secret generic dynakube --from-literal="apiToken=<YOUR_OPERATOR_TOKEN>" --from-literal="dataIngestToken=<YOUR_DATA_INGEST_TOKEN>" 

Output: secret/dynakube created

Create and Apply the DynaKube Custom Resource

Create a file – dynakube.yaml and paste the below content:

Note: Replace your API URL with corresponding value from Step 3

apiVersion: dynatrace.com/v1beta5
kind: DynaKube
metadata:
 name: dynakube
 namespace: dynatrace
 annotations:
   feature.dynatrace.com/k8s-app-enabled: "true"
   feature.dynatrace.com/injection-readonly-volume: "true"
spec:
 apiUrl: https://mbb80332.live.dynatrace.com/api
 metadataEnrichment:
   enabled: true
 oneAgent:
   cloudNativeFullStack:
     tolerations:
       - effect: NoSchedule
         key: node.role.kubernetes.io/master
         operator: Exists
       - effect: NoSchedule
         key: node-role.kubernetes.io/control-plane
         operator: Exists
 activeGate:
   capabilities:
     - routing
     - kubernetes-monitoring
   resources:
     requests:
       cpu: 500m
       memory: 512Mi
     limits:
       cpu: 1000m
       memory: 1.5Gi 

Apply the YAML:

kubectl apply -f dynakube.yaml 

Output: dynakube.dynatrace.com/dynakube created

Step 5 – Checking Dynatrace deployment status and pods running status

Check the DynaKube status:

kubectl get dynakube -n dynatrace 

Verify pods are running:

kubectl get pods -n dynatrace 

(Expected pods: dynakube-activegate-, dynakube-oneagent-, dynatrace-oneagent-csi-driver-, dynatrace-operator-, dynatrace-webhook-*)

image.png

View and download the logs in the Dynatrace UI

Go to Dynatrace account → Select Logs (or search for “Logs” in the top search bar)

image.png

Use the filters/facets on the left to filter the logs as needed and then click ‘Run query’ to execute the filter:

image.png

You can download the logs as a CSV file using the download icon:

image.png

Example for filtering the logs:

I have applied the filter below:

  • Namespace – bold-services
  • Timestamp – Last 30 minutes

image.png

Know about your cluster:

Go to Dynatrace account → Select Kubernetes (or search for " Kubernetes" in the top search bar)

You can view total number of clusters, nodes, namespaces, workloads, services, pods and containers in the Overview tab

image.png

You can click and explore each option to find out about them

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
SJ
Written by Sarulatha Jagadesan
Updated:
Comments (0)
Access denied
Access denied