This page describes how to build a custom Cluster Agent container image or use an officially released pre-built images and store it to an internal registry.

This procedure is required when you:

  • Require to build custom Cluster Agent container image
  • Require to use the pre-built Cluster Agent Image from DockerHub, or the RedHat Container Registry, and store it in the internal registry.

Otherwise, you can directly pull and use the pre-built Cluster Agent Container Images on the AppDynamics DockerHub repository or AppDynamics RedHat registry in the cluster-agent.yaml or values.yaml Helm file.

This example uses the pre-built Cluster Agent Image 21.12.0 published to DockerHub:

apiVersion: cluster.appdynamics.com/v1alpha1
kind: Clusteragent
metadata:
 name: k8s-cluster-agent
 namespace: appdynamics
spec:
 controllerUrl: "http://<account>.saas.appdynamics.com"
 account: "<account-name>"
 appName: "Cluster1"
 image: docker.io/appdynamics/cluster-agent:21.12.0
YML
deploymentMode: PRIMARY


installclusteragent: true
installInfraviz: false


# Docker images
imageInfo:
agentImage: docker.io/appdynamics/cluster-agent
agentTag: 21.12.0
operatorImage: docker.io/appdynamics/cluster-agent-operator
operatorTag:21.12.0
imagePullPolicy: Always
machineAgentImage: docker.io/appdynamics/machine-agent-analytics
machineAgentTag:21.9.0
machineAgentWinTag:21.9.0-win-ltsc2019
netVizImage: docker.io/appdynamics/machine-agent-netviz
YML

Build the Custom Cluster Agent Image

The download packages from the AppDynamics Download Portal include files you need to build and deploy the Cluster Agent container image. 

Depending on the base Image that was used to build the Cluster Agent Image, there are two package types available on the portal:

  • Alpine Linux-based 
  • Rhel Linux 7-based (recommended for Openshift cluster only)

The directory structure of the download packages for the Alpine and Rhel Linux is:

cluster-agent 
├── cluster-agent-operator.yaml 
├── appdynamics-operator-alpine-linux-amd64-21.12.0-88
├── cluster-agent-operator-openshift-1.15-or-less.yaml
├── cluster-agent-operator-openshift.yaml 
├── cluster-agent.yaml 
├── infraviz.yaml
├── infraviz-pod-security-policy.yaml
├── infraviz-security-context-constraint-openshift.yaml
├── README-alpine.md 
└── docker 
    ├── cluster-agent.zip 
    ├── Dockerfile
    ├── LICENSE 
    └── start-appdynamics
└── helm-charts
	├── Chart.yaml
    ├── README.md
    ├── crds
    ├── templates
    └── values.yaml
TEXT
cluster-agent 
├── cluster-agent-operator.yaml 
├── appdynamics-operator-rhel-linux-amd64-21.12.0-88
├── cluster-agent-operator-openshift-1.15-or-less.yaml
├── cluster-agent-operator-openshift.yaml 
├── cluster-agent.yaml 
├── infraviz.yaml
├── infraviz-pod-security-policy.yaml
├── infraviz-security-context-constraint-openshift.yaml
├── README-rhel.md 
└── docker 
    ├── cluster-agent.zip 
    ├── Dockerfile-rhel
    ├── LICENSE 
    └── start-appdynamics
└── helm-charts
	├── Chart.yaml
    ├── README.md
    ├── crds
    ├── templates
    └── values.yaml
TEXT

Build the Custom Cluster Agent Image

You can build the Rhel Linux 7-based Cluster Agent image on Red Hat Linux only. Red Hat Linux is a subscription-based system. You must subscribe to the Red Hat Linux system to use the packages manager such as microdnf, which is used in Dockerfile-rhel. Perform these tasks before running the docker build command for Rhel:

  1. Use Red Hat Linux 7 (Rhel VM Box, Rhel EC2 instance, and so on)

  2. To subscribe to the Red Hat Linux system, from a command-prompt enter:

    $ subscription-manager register --username=<your-username> --password=<your-password>
    CODE
  3. To get the pool-ids, enter:

    $ subscription-manager list --available
    CODE
  4. To attach the pool-id from step 3, enter:

    $ subscription-manager attach --pool=<pool-id>
    CODE
  5. To enable repos, enter:

    $ subscription-manager repos --enable=rhel-7-server-rpms
    $ subscription-manager repos --enable=rhel-7-server-extras-rpms
    $ subscription-manager repos --enable=rhel-7-server-optional-rpms
    CODE
  6. To install Docker on the Rhel machine, enter:

    $ yum install docker device-mapper-libs device-mapper-event-lib
    CODE
  7. To start docker services, enter:

    $ systemctl start docker.service
    $ systemctl enable docker.service
    CODE
  8. To build the Rhel based Cluster Agent image using Docker, enter:

    $ docker build -t docker.io/<organization>/cluster-agent:<Agent-Version> -f Dockerfile-rhel
    CODE

    See the Red Hat website under Using the docker command and service for more details.


These steps are also available at the official website of Red Hat under Using the docker command and service.

If you are unable to perform the preceding steps, you can use a pre-built Rhel-based Cluster Agent image mentioned in Use Pre-Built Cluster Agent Image. This pre-built option requires that you have Docker installed and Red Hat credentials. The pre-built image can run on any operating system. To get Red Hat credentials, create an account on the Red Hat portal.

  1. Change directories into the docker directory:

    $ cd docker
    CODE
  2. Build and tag a docker image using this syntax:

    $ docker build -t <registryname>/<accountname>/cluster-agent:<Agent-version> --build-arg version=<alpine-version> .
    CODE
    $ docker build -t <registryname>/<accountname>/cluster-agent:<Agent-version> -f Dockerfile-rhel .
    CODE

    To use a specific Alpine Image version, specify the version using --build-arg version=<alpine-version>.

    If you do not specify an image version, then the build command takes the latest Alpine image version automatically.


    For example, to build and tag the image version 21.12.0 using the latest alpine version on Docker Hub registry for the account name johndoe:

    $ docker build -t docker.io/johndoe/cluster-agent:21.12.0 .
    CODE
    $ docker build -t docker.io/johndoe/cluster-agent:21.12.0 -f Dockerfile-rhel .
    CODE
  3. When the build is successful, verify that the image appears in your local Docker repository.

  4.  Push the image:

    $ docker push <registryname>/<accountname>/cluster-agent:<Agent-version>
    BASH

    For example, pushing the image version 21.12.0 to Docker Hub registry for the account name Johndoe:

    $ docker push docker.io/johndoe/cluster-agent:21.12.0
    BASH

Use Pre-Built Cluster Agent Image

You can also use a pre-built Alpine-based Cluster Agent or Rhel-based Cluster Agent to an internal registry.

Alpine Cluster Agent Image

You can use the pre-built Alpine-based Cluster Agent image from the AppDynamics Docker Hub account.

  1. Log in to your Docker Hub account:

    $ docker login docker.io -u <your-username> -p <your-password>
    CODE
  2. Pull the image:

    $ docker pull docker.io/appdynamics/cluster-agent:<Agent-version>
    CODE

    For example, to pull the Alpine based cluster agent image version 21.12.0:

    $ docker pull docker.io/appdynamics/cluster-agent:21.12.0
    CODE

To push this image to internal registry or accounts:

  1. Rename the image:

    $ docker tag docker.io/appdynamics/cluster-agent:<Agent-version> <registryname>/<accountname>/cluster-agent:<Agent-version>
    CODE

    For example:

    $ docker tag docker.io/appdynamics/cluster-agent:21.12.0 docker.io/johndoe/cluster-agent:21.12.0
    CODE
  2. Push the image: 

    $ docker push <registryname>/<accountname>/cluster-agent:<Agent-version>
    CODE

    For example, to push the image version 21.12.0 to Docker Hub registry for the account name Johndoe:

    $ docker push docker.io/johndoe/cluster-agent:21.12.0
    CODE

Rhel Cluster Agent Image

Alternatively, you can use the pre-built Rhel based Cluster Agent Image from the Appdynamics Redhat Container Registry account.

  1. Log in to Red Hat Registry using your Customer Portal credentials:

    $ docker login registry.connect.redhat.com -u <your-username> -p <your-password>
    CODE
  2. Pull the image:

    $ docker pull registry.connect.redhat.com/appdynamics/cluster-agent:<Agent-version>
    CODE

    For example, to pull the Rhel based Cluster Agent version 21.12.0:

    $ docker pull registry.connect.redhat.com/appdynamics/cluster-agent:21.12.0
    CODE

You can now use the Cluster Agent image.

To push this image to internal registry, or to other accounts:

  1. Rename the image:

    $ docker tag registry.connect.redhat.com/appdynamics/cluster-agent:<Agent-version> <registryname>/<accountname>/cluster-agent:<Agent-version>
    CODE

    For example:

    $ docker tag registry.connect.redhat.com/appdynamics/cluster-agent:21.12.0 scan.connect.redhat.com/johndoe/cluster-agent:21.12.0
    CODE
  2. Push the image: 

    $ docker push <registryname>/<accountname>/cluster-agent:<Agent-version>
    CODE

    For example, to push the image version 21.12.0 to Redhat Registry for account name johndoe:

    $ docker push scan.connect.redhat.com/johndoe/cluster-agent:21.12.0
    CODE

Configure the Image in Cluster Agent YAML Specification

Make sure to reference the image in the cluster-agent.yaml spec:

apiVersion: cluster.appdynamics.com/v1alpha1
kind: Clusteragent
metadata:
  name: k8s-cluster-agent
  namespace: appdynamics
spec:
  controllerUrl: "http://<account>.saas.appdynamics.com"
  account: "<account-name>"
  appName: "Cluster1"
  image: <registryname>/<username>/cluster-agent:<Agent-version>
CODE

For assistance, contact AppDynamics Support.