To set up the Private Synthetic Agent in Google Kubernetes Engine (GKE), perform the following: 

  1. Create the Kubernetes Cluster.
  2. Build and customize the Docker image.
  3. Tag and push images to the Registry.
  4. Deploy the Private Synthetic Agent.
  5. Monitor the Kubernetes cluster.

This document contains links to Google CLI documentation. AppDynamics makes no representation as to the accuracy of GKE documentation because Google CLI controls its own documentation.

Create the Kubernetes Cluster

To create a Kubernetes cluster in GKE:

  1. Install and authenticate Google Cloud CLI.

  2. To log in to gcloud, enter:

    gcloud auth login

    The authentication occurs through a browser-based google authentication method.

  3. To set the project, enter:

    gcloud config set project

  4. To list the service accounts, enter: 

    gcloud iam service-accounts list

  5. To activate the service account, enter:

    gcloud auth activate-service-account ACCOUNT --key-file=KEY-FILE

    For information about generating keys, see Creating service account keys.

    ACCOUNT = [USERNAME]@[PROJECT-ID].iam.gserviceaccount.com

    USERNAME = Administrator or User’s username

    PROJECT-ID = Google’s Project ID of the respective project or cluster

  6. To create a GKE cluster, enter:

    gcloud container node-pools create large-pool --cluster=<GKE-CLUSTER-NAME> --machine-type=e2-standard-8 --image-type=gci --disk-size=75 --num-nodes=3 --region=<region>


    • The --machine-type and --num-nodes in the above code are AppDynamics’ recommended configuration. You can specify a configuration of your choice with a different machine type and number of nodes. See Machine types.
    • The default node size of GKE might not meet the PSA container requirements. You need to clean or delete the node groups of smaller sizes to avoid wastage of resources.
    • To achieve better performance, you can use compute-optimized machines if available in your region. For example, c2-standard-8.

    Access the Cluster

    To access the Kubernetes cluster, follow these instructions to install kubectl, a utility to interact with the cluster.

    To view the nodes of the cluster, enter:

    kubectl get nodes

Build and Customise the Docker Image

You can download the zip file for Simple Synth PSA installation from the Appdynamics Downloads Portal or from the beta upload tool. This file contains Dockerfiles for sum-chrome-agent, sum-heimdall, and Helm charts used to install the agent and set up monitoring. To build an image for sum-chrome-agent and sum-heimdall, ensure that Docker is installed. If it is not installed, you can download and install Docker from here

For sum-chrome-agent:

  1. Unzip the zip file to access the sum-chrome-agent directory.
  2. Navigate to the directory and run the following command: 

    docker build -f Dockerfile-PSA -t sum-chrome-agent:<agent-tag> .

For sum-heimdall:

  1. Unzip the zip file to access the sum-heimdall directory. 
  2. Navigate to this directory and run the following command: 

    docker build -f Dockerfile-PSA -t sum-heimdall:<heimdall-tag> .

You can use any value for <heimdall-tag> and <agent-tag>, but ensure that you use the same value in the subsequent steps.

Add Custom Python Libraries 

In addition to the standard set of libraries, you can add the custom Python libraries to the agent for the scripted measurements. To add the custom Python libraries, build an image using the downloaded base image.

  1. Create a Dockerfile and create RUN directives to run python pip. For example, to install the library algorithms you can create a Dockerfile: 

    # Use the sum-chrome-agent image we just loaded as the base image
    FROM sum-chrome-agent:<agent-tag>
       
    # Install algorithm for python3 on top of that
    RUN python3 -m pip install algorithms==0.1.4
       
       
    # We can add more RUN directives for installing more libraries
    # RUN python3 -m pip install ...

    You can create any number of RUN directives to install the required libraries.

  2. To build the new image, enter: 

    docker build -t sum-chrome-agent:<agent-tag> - < Dockerfile

    The newly built agent image contains the required libraries. 

Tag and Push Images to the Registry

You must tag and push the images to a registry for the cluster to access them.

To tag the images, enter:

docker tag sum-heimdall:<heimdall-tag> <hostname/project-id>.iam.gserviceaccount.com/sum-heimdall:<heimdall-tag> docker tag sum-chrome-agent:<agent-tag> <hostname/project-id>.iam.gserviceaccount.com/sum/sum-chrome-agent:<agent-tag>

You must log in to Docker to enable the GCR push. See procedure.

To push the images, enter:

gcloud auth configure-docker docker push <HOSTNAME>:<PROJECT-ID>/sum-heimdall:<heimdall-tag> docker push <HOSTNAME>:<PROJECT-ID>/sum-chrome-agent:<agent-tag>


Deploy the Private Synthetic Agent

The application is deployed to the cluster after the images are in the Registry. You use the Helm chart to deploy and create all Kubernetes resources in the required order. 

  1. Install Helm following the instructions here.

  2. Create a new measurement namespace where Heimdall, Postgres database, and measurement pods will run.

    To create the measurement namespace: 

    kubectl create namespace measurement

    Using a single command, you can deploy the Helm chart which contains the deployment details. To deploy the agent, you use the Helm chart (sum-psa-heimdall.tgz) in the zip file that you downloaded previously. Before you deploy the Private Synthetic Agent, you must set some configuration options. To view the configuration options, navigate to the previously downloaded sum-psa-heimdall.tgz file and enter: 

    helm show values sum-psa-heimdall.tgz > values.yaml

    These are the configuration key value pairs that you need to edit in the values.yaml file:

    Configuration Key

    Value

    heimdall > repository<HOSTNAME/PROJECT-ID>/sum-heimdall
    heimdall > tag<heimdall-tag>
    agent > repository<HOSTNAME/PROJECT-ID>/sum-chrome-agent
    agent > tag 

    <agent-tag>

    shepherd > urlShepherd URL
    shepherd > credentialscredentials
    shepherd > locationagent location

    You can leave the rest of the values set to their defaults or configure them based on your requirements. See Configure Private Synthetic Agent for details on shepherd URL, credentials, location, and optional key-value pairs.

  3. Update the postgres-storage.yaml file:

    1. Unzip the sum-psa-heimdall.tgz file.
    2. Navigate to sum-psa-heimdall/templates directory.
    3. Edit and save the postgres-storage.yaml file:

      Configuration Key

      Value

      hostPath > path

      /var/

    4. Zip the sum-psa-heimdall directory.

  4. To deploy the Helm chart using the above mentioned configuration, navigate to the previously downloaded sum-psa-heimdall.tgz file and enter: 

    helm install heimdall-onprem sum-psa-heimdall.tgz --values values.yaml --namespace measurement

    All the Kubernetes resources are created in the cluster and you can use Heimdall. After a few seconds, Heimdall initializes and is visible in the Controller.

  5. To verify if the pods are running, enter: 

    kubectl get pods --namespace measurement

    To make any changes to the values.yaml after the initial deployment, navigate to the previously downloaded sum-psa-heimdall.tgz file and enter: 

    helm upgrade heimdall-onprem sum-psa-heimdall.tgz --values values.yaml --namespace measurement

    To remove the deployment:

    helm uninstall heimdall-onprem --namespace measurement

    This is not recommended unless it is required.

Monitor the Kubernetes Cluster

The Helm chart sum-psa-monitoring.tgz in the zip you downloaded installs the monitoring stack. This Helm chart installs kube-prometheus-stack along with a custom Grafana dashboard to monitor the Private Simple Synthetic Agent.

Monitoring the deployment is optional; however, we highly recommended that you monitor the cluster to periodically check its health.  

Install the Monitoring Stack

  1. To create a separate monitoring namespace, enter:  

    kubectl create namespace monitoring

    To review configuration options, enter: 

    helm show values sum-psa-monitoring.tgz > values.yaml

    This generates a values.yaml file which contains all the configuration options. To modify and pass the generated values.yaml file while installing the Helm chart, enter:

    helm install psa-monitoring sum-psa-monitoring.tgz --values values.yaml --namespace monitoring

  2. After the monitoring stack is installed, you can Launch Grafana (which runs inside the cluster) to view the dashboard. To access Grafana from outside of the cluster, you can configure port forwarding or set up Ingress. To configure port forward to access it locally, enter:

    kubectl port-forward svc/psa-monitoring-grafana 3000:80 --namespace monitoring

  3. Launch localhost:3000 from the browser and log in using the default credentials with username as admin and password as prom-operator. A dashboard named Private Simple Synthetic Agent displays and provides details about the Kubernetes cluster, Heimdall, Postgres, and running measurements.