Today we will cover the installation and value provided by the Dynatrace Kubernetes Operator deployment
The Dynatrace operator is the k8s native way to gain full stack observability in your kubernetes and open shift environments. The Dynatrace operator provides continuous, automatic discovery & observability across your kubernetes workloads. In this lab we'll work specifically with the cloud native deployment mode which will allow us to instrument only targeted namepsaces
The following are assumed to be already running and/or configured for this workshop
First we'll need to grab the configuration files deploy the Dynatrace OneAgent.
Next we'll create a namespace for all the Dynatrace components. Then deploy the Operator and the CSI (Container Storage Interface) pods.
kubectl create namespace dynatrace
kubectl apply -f https://github.com/Dynatrace/dynatrace-operator/releases/latest/download/kubernetes.yaml
kubectl get pod -n dynatrace
NAME READY STATUS RESTARTS AGE
dynatrace-operator-678d8f9d75-tmnn2 1/1 Running 0 54s
dynatrace-webhook-b798d4cb5-nh426 1/1 Running 0 54s
dynatrace-webhook-b798d4cb5-tzz5q 1/1 Running 0 54s
kubectl apply -f https://github.com/Dynatrace/dynatrace-operator/releases/latest/download/kubernetes-csi.yaml
NAME READY STATUS RESTARTS AGE
dynatrace-oneagent-csi-driver-d4rr6 3/3 Running 0 5m33s
dynatrace-oneagent-csi-driver-hbpdh 3/3 Running 0 5m33s
dynatrace-oneagent-csi-driver-pj2xm 3/3 Running 0 5m33s
dynatrace-operator-678d8f9d75-tmnn2 1/1 Running 0 9m52s
dynatrace-webhook-b798d4cb5-nh426 1/1 Running 0 9m52s
dynatrace-webhook-b798d4cb5-tzz5q 1/1 Running 0 9m52s
Now we can deploy an application to our kubernetes cluster. This does require two changes to the dynakube yaml file we downloaded from our tenant.
namespaceSelector:
matchLabels:
could-native: enabled
oneAgent:
# Optional: enable classic fullstack monitoring and change its settings
# Cannot be used in conjunction with cloud-native fullstack monitoring, application-only monitoring or host monitoring
classicFullStack:
# Optional: If specified, indicates the OneAgent version to use
# Defaults to latest
#
# version:
oneAgent:
# Optional: enable classic fullstack monitoring and change its settings
# Cannot be used in conjunction with cloud-native fullstack monitoring, application-only monitoring or host monitoring
cloudNativeFullStack:
# Optional: If specified, indicates the OneAgent version to use
# Defaults to latest
#
# version:
# Optional: when enabled, and if Istio is installed on the Kubernetes environment, then the
# Operator will create the corresponding VirtualService and ServiceEntry objects to allow access
# to the Dynatrace cluster from the agent or the activeGate. Disabled by default.
#
# enableIstio: false
namespaceSelector:
matchLabels:
could-native: enabled
oneAgent:
# Optional: enable classic fullstack monitoring and change its settings
# Cannot be used in conjunction with cloud-native fullstack monitoring, application-only monitoring or host monitoring
cloudNativeFullStack:
# Optional: If specified, indicates the OneAgent version to use
# Defaults to latest
#
# version:
kubectl apply -f dynakube.yaml
secret/dynatrace-lab created
dynakube.dynatrace.com/dynatrace-lab created
kubectl get pods -n dynatrace
NAME READY STATUS RESTARTS AGE
dynatrace-lab-activegate-0 1/1 Running 0 2m41s
dynatrace-lab-oneagent-5mhf9 1/1 Running 0 2m42s
dynatrace-lab-oneagent-6vqcd 1/1 Running 0 2m42s
dynatrace-lab-oneagent-t4bz7 1/1 Running 0 2m42s
dynatrace-oneagent-csi-driver-d4rr6 3/3 Running 0 29m
dynatrace-oneagent-csi-driver-hbpdh 3/3 Running 0 29m
dynatrace-oneagent-csi-driver-pj2xm 3/3 Running 0 29m
dynatrace-operator-678d8f9d75-tmnn2 1/1 Running 0 33m
dynatrace-webhook-b798d4cb5-nh426 1/1 Running 0 33m
dynatrace-webhook-b798d4cb5-tzz5q 1/1 Running 0 33m
Now that we've gotten our pods up and running we'll turn on feature flags the Kubernetes API and enable PVC metric ingestion in our cluster. These features are both dependent on the activegate we deployed with the Dynakube yaml in the last step.
Out of the box, Dynatrace automatically collects telemetry for
note: this module may not be enabled in your environment
)Lets also note what is missing, Kubernetes events!
We configured Dynatrace to capture all events in this cluster in our last step (enabling "monitor events") We will now create a new application deployment which will populate Kubernetes native events in our dashboard
Now we will deploy our sample application across two namespaces. We will use the Google Microservices demo application "Online boutique", this version has been branched from the original. This version uses and nginx ingresses and pvc for the redis pod for the purposes of this lab.
kubectl create namespace lower
kubectl create namespace production
kubectl label namespace production cloud-native=enabled
namespaceSelector:
value. This can be modified to match your own environment variables.kubectl apply -f https://raw.githubusercontent.com/kyledharrington/dt-boutique/main/dt-boutique.yaml -n lower
kubectl apply -f https://raw.githubusercontent.com/kyledharrington/dt-boutique/main/dt-boutique.yaml -n production
kubectl get pod -n production; kubectl get pod -n lower
kubectl get svc --all-namespaces| grep nginx
lower nginx LoadBalancer 10.28.0.96 34.82.229.185 80:32116/TCP 4d7h
production nginx LoadBalancer 10.28.14.73 34.105.55.209 80:32543/TCP 4d7h
While we configured the front end of the application, the OneAgent daemonset we deployed earlier has been collecting our newly deployed application's telemetry data.
Now that we've seen how to dynatrace instruments an existing application lets see how dynatrace handles and instruments pods scaling in our production environment
kubectl get pod -n production
kubectl get deployments -n production
kubectl scale deployment -n production cartservice --replicas=10
kubectl get pods -n production
kubectl scale deployment -n production cartservice --replicas=100
kubectl scale deployment cartservice --replicas=10
Today we reviewed how the dynatrace platform can be leveraged to provide full stack observability across your kubernetes environments. To you learned how to