This repository contains labs for the Hands-On Kubernetes Session. We will be using Google Kubernetes Engine (GKE) for this hands-on but this will work on other PaaS platforms as well.

For the purposes of the Hands-On, we will automate and make the steps seamless for the participants

Prerequisites

What You'll Learn

Sign up for a Google Cloud Platform Account

Head over to https://cloud.google.com/free/ and sign up for a free GCP account with your existing Google account.

You can also signup for a new Google Account if you don't have one

Upon signup, you will have free credits tied to your GCP account. (12 months + 400AUD)

You can login to your GCP console here.

GCP-Homepage

Enable Kubernetes Engine API

You will also need to Enable your API Billing with Kubernetes Engine API.

k8s-Engine

You should be prompted to the billing page while setting up your GKE instance.

If not, you can follow the steps here

Activate Cloud Shell

GKE-Menu

Click on the Terminal Icon on the top right

A Cloud based Terminal lookalike will appear at the bottom of the page

We will start setting up our GKE Cluster

3. Create your GKE Cluster

GKE-CLI

Create your GKE cluster named k8sworkshop running Ubuntu in GKE with the following command. We will also be creating a compute VM for a Dynatrace Activegate. We will use the Dynatrace Activegate for Kubernetes integration.

gcloud container clusters create k8sworkshop --image-type=ubuntu --zone australia-southeast1-a
gcloud compute instances create dynatrace-activegate --image-family ubuntu-1604-lts --image-project ubuntu-os-cloud --zone australia-southeast1-a

Once completed, you will have a running GKE Cluster!

GKE-CLI Running kubectl get nodes will reveal number of nodes

As per the official instructions here for the Kubernetes integration, you will need to setup an Environment Activegate first.

SSH into Dynatrace-Activegate terminal and install Activegate

  1. On the left navigation bar in Google Cloud, go to Compute Engine -> VM instancesActivegate-connected
  2. Click on the SSH button on the dynatrace-activegate row and SSH into the instance Activegate-connected
  3. Within Dynatrace, click on Deploy Dynatrace on the left menu
  4. Click on "Install Activegate" at the bottom of the page
  5. Click on "Linux"
  6. Copy Step 2 and paste into your terminal.
  7. Copy Step 4 and append "sudo" (installing as root) onto terminal Copy-AG-Commands

Once completed, you should see Activegate under Deployment Status.

Activegate-connected

Setup the K8S Overview Dashboard

Go to Settings -> Process and Containers -> Process group detection -> Enable Cloud Application and workload detection

Enable Cloud Workload

Automating the steps from our offical documentation page, we provided the API URL and bearer token automatically via API. Back in your main Cloud Shell terminal, enter the below

wget -O- https://raw.githubusercontent.com/Dynatrace-APAC/Workshop-Kubernetes/master/setup-k8s-ui.sh | bash

With the above results, enter the values to Settings -> Cloud and Virtualization -> Kubernetes

K8S-integration

  1. Give a name for the connection eg. GKE K8S
  2. Enter in your Kubernetes API URL Target
    • Copy the Kubernetes API URL from the SSH terminal
  3. Enter in the Kubernetes Bearer Token
    • Copy the Bearer Token from the SSH terminal
  4. Disable "Require valid certificates for communication with API server"
  5. Add another event field selector
  6. User the below for the field selector name Hipster shop
  7. User the below for the Field selector expression metadata.namespace=hipster-shop
  8. Save and Click on Connect

Once successfully connected, click on Kubernetes on the left menu and explore the Kubernetes UI.

K8S-integration

  1. On your Google Cloud Console, on the left navigational bar, go to Kubernetes Engine -> Applications
  2. Click on "Deploy From Marketplace"
  3. Search for Dynatrace in the search field above Activegate-connected
  4. Click on Dynatrace OneAgent Operator and click on Configure
  5. Fill in the following fields

Copy the values into your GCP console Activegate-connected

  1. Click on Deploy
    Activegate-connected

Once completed, you can click on Hosts on the left panel to see your connected K8S nodes (3 nodes)

GKE-Hosts

For our Hands-On, you will need to run Hipster Shop which is a Google sample application.

Run the Hipster Shop

wget -O- https://raw.githubusercontent.com/Dynatrace-APAC/Workshop-Kubernetes/master/deploy.sh | bash

Once deployed, you can locate the front-end endpoint from GCP (Kubernetes Engine -> Services & Ingress)

JSON

Once running, you can go to the exposed frontend-external IP to go to Hipster Shop.

JSON

Automatic Discovery of services

In Dynatrace, go to Transactions and Services to see the automatic 5 discovered services. Discovered Services

You will realized that some services are discovered but some might not match Hipster Shop's Service architecture. Hipster Shop uses cutting edge technologies (such as GPRC) which Dynatrace supports with the constant evolution in the cloud.

Architecture

Enabling additional features within OneAgent

Because of the rapid rate of change coming to OneAgent, features that are in Early Access aren't automatically enabled by default. This is to prevent unforseen circumstances which might impact your production environments. For the purposes of workshop, we can enable these features. Go to Settings -> Service-side service monitoring -> Deep Monitoring -> New Oneagent Features

Under Global Settings, enable the following feature flags. They are on different pages so you would need to toggle through the pages.

You can use the search filter bar to search for "GRPC"GRPC-Features

Features

Make sure all the below features all enabled, including the 2 additional NodeJS feature flags. All-Features

Enabling OneAgents features requires a restart of the pods. Run the following command to restart the pods.

kubectl delete pods --all -n hipster-shop

Restart

Back in Dynatrace, go to and Transactions and Services to see the updated list of services. Discovered Services

Clicking on Go Service ":8080" followed by Service Flow, you can see that the service are automatically detected and matches the architecture diagram above.

Service Flow

Explore the various functionalities within the Kubernetes View such as Cluster Utilization, Cluster Workloads, K8S Events

KubernetesUI

Analyze the Kubernetes Cluster utilization

KubernetesUI

Analyze the Kubernetes Cluster Workloads

KubernetesUI

Analyze the Kubernetes Events

KubernetesUI

Analyze the Kubernetes Namespace

KubernetesUI

Explore Cloud Applications by clicking onto them

KubernetesUI

We hope you enjoyed this lab and found it useful. We would love your feedback!

How was your overall experience with this lab?

Excellent Good Average Fair Poor

What did you benefit most from this lab?

Using OneAgent Operator to deploy in Kubernetes Setting up Kubernetes integation Enabling early access feature flags Learning Kubernetes View in Dynatrace

How likely are you to recommend this lab to a friend or colleague?

Very Likely Moderately Likely Neither Likely nor unlikely Moderately Unlikely Very Unlikely