The goal of this lab is to deploy the AppDynamics Cluster Agent into a MicroK8s Kubernetes cluster in under five minutes.
Access to an AppDynamics SaaS Controller is required.
MicroK8s provides a simple and fast installation of a fully-conformant Kubernetes cluster. Read more about MicroK8s and Kubernetes at: MicroK8s and Kubernetes
This lab is designed to run on Ubuntu, using MicroK8s and Docker CE. Clone this repository using:
git clone https://github.com/APPDRYDER/AppD-Cluster-Agent-MicroK8s.git
cd AppD-Cluster-Agent-Microk8s
Download the AppDynamics Ubuntu cluster agent from: AppDynamics Downloads into the directory AppD-Cluster-Agent-Microk8s
This will download the zip archive appdynamics-cluster-agent-ubuntu-4.5.16.780.zip
or a higher version.
From the directory AppD-Cluster-Agent-Microk8s
unzip the Cluster Agent into the directory cluster-agent
using:
unzip appdynamics-cluster-agent-ubuntu-4.5.16.780.zip -d cluster-agent
From the AppDynamics SaaS controller obtain the following configuration parameters: controllerUrl
, Account Name
and Access Key
In the cluster agent directory cluster-agent
edit the resource definition cluster-agent.yaml
:
Modify the fields:
appName: "<app-name>"
controllerUrl: "http://<appdynamics-controller-host>:8080"
account: "<account-name>"
image: "docker.io/appdynamics/cluster-agent:4.5.16"
Choose a unique <app-name>
to represent this cluster. The above configuration uses the Cluster Agent image
provided by AppDynamics for Ubuntu. This ok for this lab, however you can Build the Cluster Agent Container Image and source from a private respository.
This lab deploys pods into the namespace test
. Include additional namespaces
to monitor by adding the field nsToMonitor
, add the following namespaces:
nsToMonitor:
- test
- default
- appdynamics
- kube-system
For additional configuration options review Configure The Cluster Agent
In the directory AppD-Cluster-Agent-Microk8s
run the following commands using the script ctl.sh
./ctl.sh ubuntu-update
./ctl.sh docker-install
./ctl.sh k8s-install
The docker-install
and k8s-install
commands require the current ssh/shell session to be restarted, for the usermod command to work successfully. Exit the current ssh/shell session and re-enter before continuing.
./ctl.sh k8s-start
Review the pods and services running in the cluster using:
microk8s.kubectl get pods,services --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system pod/coredns-7b67f9f8c-8s6zq 1/1 Running 1 113s
kube-system pod/metrics-server-v0.2.1-598c8978c-c2vjf 2/2 Running 0 107s
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default service/kubernetes ClusterIP 10.152.183.1 <none> 443/TCP 2m52s
kube-system service/kube-dns ClusterIP 10.152.183.10 <none> 53/UDP,53/TCP,9153/TCP 113s
kube-system service/metrics-server ClusterIP 10.152.183.207 <none> 443/TCP 107s
The kube-dbs
and metrics-server
should be running in the cluster.
In the directory AppD-Cluster-Agent-Microk8s
run the following commands using the script ctl.sh
./ctl.sh pods-create
The above command will create a namespace called "test" and deploy two pods (alpine1, alpine2) with single containers, and two services (busyboxes1, busyboxes2) each with two containers.
Review the K8s resource definitions in the directory pods for details of these resources.
Review what pods and namespaces are running in the cluster using the command:
microk8s.kubectl get pods --all-namespaces
The output should show two alpine pods and four busybox pods running:
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-7b67f9f8c-8s6zq 1/1 Running 1 5m30s
kube-system metrics-server-v0.2.1-598c8978c-c2vjf 2/2 Running 0 5m24s
test alpine1 1/1 Running 0 20s
test alpine2 1/1 Running 0 20s
test busybox1a 1/1 Running 0 20s
test busybox1b 1/1 Running 0 20s
test busybox2a 1/1 Running 0 19s
test busybox2b 1/1 Running 0 19s
Obtain the Account Access Key from the AppDynamics SaaS controller and configure the enviroment variable:
export APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY=<access-key>
In the directory AppD-Cluster-Agent-Microk8s
Deploy and start the AppDynamics Cluster Agent using the command:
./ctl.sh appd-create-cluster-agent
Please note the above command will look for the Cluster Agent resources in the sub-directory cluster-agent
Check that the AppDynamics Cluster Agent and Operator are in the Running
state, using the command:
microk8s.kubectl get pods,services --all-namespaces
If errors are reported, check the resource defintion file cluster-agent.yaml
. Additonal steps are required for SSL and proxy services. See Proxy and SSL Configuration
The Cluster Agent resources: agent, operator, secret and namespace, can be deleted using:
./ctl.sh appd-delete-cluster-agent
Then restarted using:
./ctl.sh appd-create-cluster-agent
Login into the AppDynamics Conroller and click through the Servers
tab to the Cluster
view. The cluster named by the field appName: "<app-name>"
should be visible.
Click into this cluster to see the visibility AppDynamics provides into Kubernetes.
Details of how to use the AppDynamics Cluster Agent Visibility are provided here: Use the Cluster Agent
Review the automation script ctl.sh
for exact details of how this deployment was performed and configured.
Thank you for using this lab please provide feedback. Please fork, improve and submit pull requests.