Download PDF
Download page Set up the Private Synthetic Agent in Google Kubernetes Engine.
Set up the Private Synthetic Agent in Google Kubernetes Engine
To set up the Private Synthetic Agent in Google Kubernetes Engine (GKE), perform the following:
- Create the Kubernetes Cluster.
- Build and customize the Docker image.
- Tag and push images to the Registry.
- Deploy the Private Synthetic Agent.
- 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:
Install and authenticate Google Cloud CLI.
To log in to gcloud, enter:
gcloud auth login
The authentication occurs through a browser-based google authentication method.
To set the project, enter:
gcloud config set project
To list the service accounts, enter:
gcloud iam service-accounts list
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
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
- The
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
:
- Unzip the zip file to access the sum-chrome-agent directory.
Navigate to the directory and run the following command:
docker build -f Dockerfile-PSA -t sum-chrome-agent:<agent-tag> .
For sum-heimdall
:
- Unzip the zip file to access the sum-heimdall directory.
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.
Create a Dockerfile and create
RUN
directives to run python pip. For example, to install the libraryalgorithms
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.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:
|
You must log in to Docker to enable the GCR push. See procedure.
To push the images, enter:
|
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.
Install Helm following the instructions here.
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 downloadedsum-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 > url
Shepherd URL
shepherd > credentials
credentials
shepherd > location
agent 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.
Update the
postgres-storage.yaml
file:- Unzip the
sum-psa-heimdall.tgz
file. - Navigate to
sum-psa-heimdall/templates
directory. Edit and save the
postgres-storage.yaml
file:Configuration Key
Value
hostPath > path
/var/
Zip the
sum-psa-heimdall
directory.
- Unzip the
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.
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 downloadedsum-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
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 generatedvalues.yaml
file while installing the Helm chart, enter:helm install psa-monitoring sum-psa-monitoring.tgz --values values.yaml --namespace monitoring
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
Launch l
ocalhost:3000
from the browser and log in using the default credentials with username asadmin
and password asprom-operator
. A dashboard named Private Simple Synthetic Agent displays and provides details about the Kubernetes cluster, Heimdall, Postgres, and running measurements.