Set up the Web Monitoring PSA and API Monitoring PSA in Amazon Elastic Kubernetes Service (Amazon EKS) as follows. If you want to set up PSA in an existing Kubernetes cluster, skip the Create the Kubernetes Cluster section.

  1. Create the Kubernetes Cluster.
  2. Build and customise the Docker image.
  3. Tag and push images to the Registry.
  4. Deploy the Web Monitoring PSA and API Monitoring PSA.
  5. Monitor the Kubernetes cluster.

Most of the steps are common for both Web Monitoring PSA and API Monitoring PSA. Wherever applicable, the differences in steps are highlighted.

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

Create the Kubernetes Cluster

To create a Kubernetes cluster in Amazon EKS:

  1. Install and configure AWS CLI.

  2. Based on your platform, install eksctl following the instructions here.

  3. To create a Kubernetes cluster, enter:

    EKSCTL_CLUSTER_NAME=eks-heimdall-onprem-cluster
    EKSCTL_NODEGROUP_NAME=eks-heimdall-onprem-worker-nodes
    EKSCTL_KUBERNETES_VERSION=1.x.x
     
     
    eksctl create cluster \
    --name ${EKSCTL_CLUSTER_NAME} \
    --version ${EKSCTL_KUBERNETES_VERSION} \
    --region us-west-2 \
    --zones us-west-2a,us-west-2b,us-west-2c \
    --nodegroup-name ${EKSCTL_NODEGROUP_NAME} \
    --node-type t3.2xlarge \
    --nodes 4 \
    --nodes-min 2 \
    --nodes-max 6 \
    --ssh-access \
    --ssh-public-key ~/.ssh/id_rsa.pub \
    --managed \
    --vpc-nat-mode Disable
    CODE

    Replace the EKSCTL_KUBERNETES_VERSION with one of the EKS Kubernetes versions

    The node-type, nodes, nodes-min, and nodes-max in the code snippet are selected based on the recommended configuration type. You can specify a configuration of your choice with a different type and number of nodes. See EC2 instance types.

Access the Cluster

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

To verify that the cluster is running, enter:

kubectl get nodes
CODE

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 to install the agents and set up monitoring:

  • Web Monitoring PSA: Dockerfiles for sum-chrome-agent, sum-heimdall, and Helm charts
  • API Monitoring PSA: Dockerfiles for sum-api-monitoring-agent, sum-heimdall, and Helm charts

To build an image for sum-chrome-agent, sum-api-monitoring-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> .
    CODE

For sum-api-monitoring-agent:

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

    docker build -f Dockerfile-PSA -t sum-api-monitoring-agent:<agent-tag> .
    CODE

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> .
    CODE

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

(Optional) Add Custom Python Libraries 

This section is applicable only for Web Monitoring PSA.

In addition to the available standard set of libraries, you can add custom Python libraries to the agent to use in scripted measurements. You build a new image based on the image you loaded as the base image.

  1. Create a Dockerfile and then 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 ...
    CODE

    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
    CODE

    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 it. The Amazon EKS clusters pull the images from Elastic Container Registry (ECR), which is the managed registry provided by AWS. 

To tag the images, enter:

Web Monitoring PSA:

docker tag sum-heimdall:<heimdall-tag> <aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-heimdall:<heimdall-tag>
docker tag sum-chrome-agent:<agent-tag> <aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-chrome-agent:<agent-tag>
CODE

API Monitoring PSA:

docker tag sum-heimdall:<heimdall-tag> <aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-heimdall:<heimdall-tag>
docker tag sum-api-monitoring-agent:<agent-tag> <aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-api-monitoring-agent:<agent-tag>
CODE

You need to replace <aws_account_id> & <region> with your account id and region values. 

To create repositories, enter: 

Web Monitoring PSA:

aws ecr create-repository --repository-name sum/sum-heimdall
aws ecr create-repository --repository-name sum/sum-chrome-agent
CODE

API Monitoring PSA:

aws ecr create-repository --repository-name sum/sum-heimdall
aws ecr create-repository --repository-name sum/sum-api-monitoring-agent
CODE

To push the images, enter:


Web Monitoring PSA:

aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin <aws_account_id>.dkr.ecr.<region>.amazonaws.com
docker push <aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-heimdall:<heimdall-tag>
docker push <aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-chrome-agent:<agent-tag>
CODE

API Monitoring PSA:

aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin <aws_account_id>.dkr.ecr.<region>.amazonaws.com
docker push <aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-heimdall:<heimdall-tag>
docker push <aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-api-monitoring-agent:<agent-tag>
CODE

Deploy the Web Monitoring PSA and API Monitoring PSA

Ensure that you follow the applicable sequence of steps when installing Web Monitoring PSA and API Monitoring PSA, respectively; some steps are common for both the procedures.

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

  1. Install Helm following these instructions.

  2. Install PSA with one of the following databases:

    For Heimdall with Postgres database:

    1. Create a new measurement namespace to run Heimdall, Postgres database, and measurement pods. 

      You can either use the Postgres database or Heimdall with in-memory database at a time.

      To create a new measurement namespace, enter: 

      kubectl create namespace measurement
      CODE

      Using a single command, you can deploy the Helm chart which contains the deployment details. To deploy the agent, 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
      CODE

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

      Web Monitoring PSA:

      Configuration Key

      Value

      heimdall > repository<aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-heimdall

      heimdall > tag

      <heimdall-tag>
      heimdall > pullPolicyAlways
      chromeAgent > repository<aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-chrome-agent
      chromeAgent > tag<agent-tag>
      shepherd > urlShepherd URL
      shepherd > credentialscredentials
      shepherd > locationagent location

      API Monitoring PSA:

      Configuration Key

      Value

      heimdall > repository<aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-heimdall
      heimdall > tag<heimdall-tag>
      heimdall > pullPolicyAlways
      apiMonitoringAgent > repository<aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-api-monitoring-agent
      apiMonitoringAgent > 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 Web Monitoring PSA and API Monitoring PSA for details on shepherd URL, credentials, location, and optional key-value pairs.

      You need to replace <aws_account_id> and <region> with your account and region values.


    For Heimdall with in-memory database (Ignite):

    1. Create a new measurement namespace to run Heimdall with in-memory database using Ignite, and measurement pods. 

      You can either use the Postgres database or Heimdall with in-memory database at a time.

      To create a new measurement namespace, enter: 

      kubectl create namespace measurement
      CODE

      Using a single command, you can deploy the Helm chart which contains the deployment details. To deploy the agent, 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
      CODE

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

      Web Monitoring PSA:

      Configuration Key

      Value

      heimdall > repository<aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-heimdall
      heimdall > tag<heimdall-tag>
      heimdall > pullPolicyAlways
      heimdall > replicaCount1
      ignite > devmode true
      chromeAgent > repository<aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-chrome-agent
      chromeAgent > tag<agent-tag>
      shepherd > urlShepherd URL
      shepherd > credentialscredentials
      shepherd > locationagent location

      You cannot create more than one container.

      API Monitoring PSA:

      Configuration Key

      Value

      heimdall > repository<aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-heimdall
      heimdall > tag<heimdall-tag>
      heimdall > pullPolicyAlways
      heimdall > replicaCount1
      ignite > devmode true
      apiMonitoringAgent > repository<aws_account_id>.dkr.ecr.<region>.amazonaws.com/sum/sum-api-monitoring-agent
      apiMonitoringAgent > tag<agent-tag>
      shepherd > urlShepherd URL
      shepherd > credentialscredentials
      shepherd > locationagent location

      You cannot create more than one container.

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

  3. 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
    CODE

    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.

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

    kubectl get pods --namespace measurement
    CODE

    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
    CODE

    To remove the deployment:

    helm uninstall heimdall-onprem --namespace measurement
    CODE

    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
    CODE

    To review configuration options, enter: 

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

    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
    CODE
  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
    CODE
  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, Heimdall with in-memory database (Ignite), Postgres, and running measurements.