Install the Cluster Agent with the Kubernetes CLI

This page describes how to install the Cluster Agent using the Kubernetes CLI which is an alternative toInstall the Cluster Agent with Helm Charts.

Installation Procedure

  1. If you have not already installed the metrics-server https://github.com/kubernetes-sigs/metrics-server for the most recent installation instructions.
    kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
  2. Download the Kubernetes or OpenShift Cluster Agent bundle from the Download portal, unzip the contents of the bundle to the current directory:
    unzip appdynamics-cluster-agent-alpine-linux-<version>.zip
  3. Create a namespace appdynamics
    kubectl create namespace appdynamics
  4. Install the Cluster Agent Operator using the correct Kubernetes and OpenShift version (where applicable):
    Kubernetes >= 1.16
    kubectl create -f cluster-agent-operator.yaml
    OpenShift with Kubernetes >= 1.16
    kubectl create -f cluster-agent-operator-openshift.yaml
    OpenShift with Kubernetes <= 1.15
    kubectl create -f cluster-agent-operator-openshift-1.15-or-less.yaml
    Note: You can also install Cluster Agent Operator from OpenShift OperatorHub in your OpenShift cluster.
  5. Based on the Account Access Key for the Controller, create the Controller Access Key Secret that the Cluster Agent reports to:
    kubectl -n appdynamics create secret generic cluster-agent-secret --from-literal=controller-key=<access-key>
  6. Edit cluster-agent.yaml nsToMonitorRegexThis example assumes the use of the pre-built Cluster Agent image on Docker Hub. See Configure the Cluster Agent, Cluster Agent Container Image to build your own image.
    apiVersion: cluster.appdynamics.com/v1alpha1
    kind: Clusteragent
    metadata:
    name: k8s-cluster-agent
    namespace: appdynamics
    spec:
    appName: "dev-cluster"
    controllerUrl: "http://mycontroller.com:8080"
    account: "my-account"
    # docker image info where, <version> is the image tag version that you are installing
    image: "docker.io/appdynamics/cluster-agent:<version>"
    serviceAccountName: appdynamics-cluster-agent
    nsToMonitorRegex: namespace1|namespace2
    stdoutLogging: "true"
  7. (Optional) If you require multiple Cluster Agents to monitor a single cluster, set up Target Allocator. In thecluster-agent.yaml file, enable target allocator with the number of Cluster Agent replicas to enable the operator to create Cluster Agent replicas. See Target Allocator.
    Note: Auto-instrumentation and containerAppCorrelationMethod (for Kubernetes >= 1.25) is not supported when the Target Allocator is enabled. Set spec.instrumentationMethod to "" or "None" and spec.containerAppCorrelationMethod to ""or "none".

    cluster-agent.yaml

    …
    spec:
    …
    appName: "my-cluster"
    nsToMonitorRegex: ".*"
    instrumentationMethod: "None"
    containerAppCorrelationMethod: "none"
    targetAllocator:
    enabled: true
    clusterAgentReplicas: 3
    podConfig:
    imagePullPolicy: Always
    imagePullSecret: ecr-secret
    priorityClassName: high-priority
    serviceAccountName: appdynamics-target-allocator
    nodeSelector:{}
    tolerations:[]
    resources:
    limits:
    cpu: 500m
    memory: 500Mi
    requests:
    cpu: 200m
    memory: 200Mi
    labels:{}
    securityContext:{}
  8. Install the Cluster Agent:
    kubectl create -f cluster-agent.yaml
See Validate the Cluster Agent Installation to validate and troubleshoot the installation. Once the install is validated, see Container Installation Options for options to install App Server Agents in applications in the cluster.