Download PDF
Download page Build the Cluster Agent Container Image.
Build the Cluster Agent Container Image
This page describes how to build a Cluster Agent container image or push a pre-built image to an internal registry.
This procedure is required when you:
- Need to build your own image to satisfy internal image policies, or
- Require that the pre-built Cluster Agent Image from Docker Hub, or the Red Hat Container Registry, is stored in an internal container registry.
See Install the Cluster Agent.
Otherwise, you can reference the pre-built Cluster Agent Images on Docker Hub and the Red Hat Container Registry in the cluster-agent.yaml
or values.yaml
Helm file. This example uses the pre-built Cluster Agent Image 21.5.0 published to Docker Hub:
apiVersion: 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.5.0
Build the Custom Cluster Agent Image
The download packages from the AppDynamics Download Portal include files you need to build and deploy the container image for the Cluster Agent.
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 base Image
- Rhel Linux 7-based base Image
The directory structure of the download packages for the Alpine and Rhel Linux is:
cluster-agent
├── cluster-agent-operator.yaml
├── cluster-agent-operator-1.15-or-less.yaml
├── 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
cluster-agent
├── cluster-agent-operator.yaml
├── cluster-agent-operator-1.15-or-less.yaml
├── 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
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:
Use Red Hat Linux 7 (Rhel VM Box, Rhel EC2 instance, and so on)
To subscribe to the Red Hat Linux system, from a command-prompt enter:
$ subscription-manager register --username=<your-username> --password=<your-password>
CODETo get the pool-ids, enter:
$ subscription-manager list --available
CODETo attach the pool-id from step 3, enter:
$ subscription-manager attach --pool=<pool-id>
CODETo 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
CODETo install Docker on the Rhel machine, enter:
$ yum install docker device-mapper-libs device-mapper-event-lib
CODETo start docker services, enter:
$ systemctl start docker.service $ systemctl enable docker.service
CODETo build the Rhel based Cluster Agent image using Docker, enter:
$ docker build -t docker.io/<organization>/cluster-agent:<Agent-Version> -f Dockerfile-rhel
CODESee the Red Hat website under Using the docker command and service for more details.
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.
Change directories into the
docker
directory:$ cd docker
CODEBuild 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 .
CODETo use a specific Alpine Image version, set 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.5.0 using alpine version 3.14.0 on Docker Hub registry for the account namejohndoe:
$ docker build -t docker.io/johndoe/cluster-agent:21.5.0 --build-arg version=3.14.0 .
CODE$ docker build -t docker.io/johndoe/cluster-agent:21.5.0 -f Dockerfile-rhel .
CODEWhen the build is successful, verify that the image appears in your local Docker repository.
Example output:Sending build context to Docker daemon 16.43 MB Step 1/11 : FROM alpine:3.14.0 ---> f70734b6a266 Step 2/11 : RUN apk --update add --no-cache unzip ca-certificates && update-ca-certificates ---> Running in 8934bf7ceff4 fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz fetch http://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz (1/2) Installing ca-certificates (20191127-r2) (2/2) Installing unzip (6.0-r6) Executing busybox-1.31.1-r9.trigger Executing ca-certificates-20191127-r2.trigger OK: 7 MiB in 16 packages WARNING: ca-certificates.crt does not contain exactly one certificate or CRL: skipping ---> c4f323715731 Removing intermediate container 8934bf7ceff4 Step 3/11 : ENV CLUSTER_AGENT_HOME /opt/appdynamics/cluster-agent/ ---> Running in 6a969744fb9b ---> b0391f9c5f8d Removing intermediate container 6a969744fb9b Step 4/11 : ADD cluster-agent.zip /tmp/cluster-agent.zip ---> f79263dfb9e5 Removing intermediate container 6e12402d1ab4 Step 5/11 : RUN addgroup -S -g 1001 appdynamics && adduser -S -s /bin/sh -G appdynamics -u 1001 appdynamics && mkdir -p ${CLUSTER_AGENT_HOME} && unzip -oq /tmp/cluster-agent.zip -d ${CLUSTER_AGENT_HOME} && rm /tmp/cluster-agent.zip && rm -rf /opt/appdynamics/cluster-agent/config/agent-monitoring.yml && rm -rf /opt/appdynamics/cluster-agent/config/instrumentation.yml && mkdir /opt/appdynamics/cluster-agent/config/agent-monitoring && touch /opt/appdynamics/cluster-agent/config/agent-monitoring/agent-monitoring.yml && ln -s /opt/appdynamics/cluster-agent/config/agent-monitoring/agent-monitoring.yml /opt/appdynamics/cluster-agent/config/agent-monitoring.yml && mkdir /opt/appdynamics/cluster-agent/config/instrumentation && touch /opt/appdynamics/cluster-agent/config/instrumentation/instrumentation.yml && ln -s /opt/appdynamics/cluster-agent/config/instrumentation/instrumentation.yml /opt/appdynamics/cluster-agent/config/instrumentation.yml ---> Running in 00eb188bb320 ---> 10fad1e38294 Removing intermediate container 00eb188bb320 Step 6/11 : ADD start-appdynamics ${CLUSTER_AGENT_HOME} ---> 07abbd20ea79 Removing intermediate container 668a1f36a8ae Step 7/11 : RUN mkdir -p ${CLUSTER_AGENT_HOME}/logs && chmod 774 ${CLUSTER_AGENT_HOME}/logs && chmod 744 ${CLUSTER_AGENT_HOME}/start-appdynamics && chown -R appdynamics:appdynamics /opt/appdynamics ---> Running in d6c1327eb50c ---> 8ff4b999365e Removing intermediate container d6c1327eb50c Step 8/11 : USER 1001 ---> Running in a6f7a43b3f2e ---> 33eef78218d9 Removing intermediate container a6f7a43b3f2e Step 9/11 : WORKDIR ${CLUSTER_AGENT_HOME} ---> dae7480d00e2 Removing intermediate container bb102f148e76 Step 10/11 : ENTRYPOINT /bin/sh ---> Running in 3b2cc9d45abe ---> 46e4d0f089dd Removing intermediate container 3b2cc9d45abe Step 11/11 : CMD -c ./start-appdynamics ---> Running in 101fa3df7c13 ---> bb507184ef54 Removing intermediate container 101fa3df7c13 Successfully built bb507184ef54
TEXTSending build context to Docker daemon 17.77 MB Step 1/15 : FROM registry.access.redhat.com/rhel7-minimal ---> 5391d6975c2a Step 2/15 : MAINTAINER AppDynamics ---> Running in 612100a3778f ---> 8b285fe8d611 Removing intermediate container 612100a3778f Step 3/15 : LABEL name "AppDynamics ClusterAgent" vendor "AppDynamics" version "20.5.0" release "1" url "https://www.appdynamics.com" summary "AppDynamics monitoring solution for applications deployed to Kubernetes clusters" description "The ClusterAgent monitors state of Kubernetes resources and derives metrics to provide visibility into common application impacting issues." ---> Running in d66fd4a94dd5 ---> 4b4d098ebe61 Removing intermediate container d66fd4a94dd5 Step 4/15 : RUN microdnf --enablerepo=rhel-7-server-rpms install unzip shadow-utils --nodocs && microdnf clean all ---> Running in 329e88ed3384 Downloading metadata... Transaction: 4 packages ustr-1.0.4-16.el7.x86_64 (rhel-7-server-rpms) libsemanage-2.5-14.el7.x86_64 (rhel-7-server-rpms) shadow-utils-2:4.6-5.el7.x86_64 (rhel-7-server-rpms) unzip-6.0-21.el7.x86_64 (rhel-7-server-rpms) Downloading packages... Running transaction test... Installing: ustr;1.0.4-16.el7;x86_64;rhel-7-server-rpms Installing: libsemanage;2.5-14.el7;x86_64;rhel-7-server-rpms Installing: shadow-utils;2:4.6-5.el7;x86_64;rhel-7-server-rpms Installing: unzip;6.0-21.el7;x86_64;rhel-7-server-rpms Complete. Complete. ---> dede0f99b5d6 Removing intermediate container 329e88ed3384 Step 5/15 : ENV CLUSTER_AGENT_HOME /opt/appdynamics/cluster-agent/ ---> Running in 063fabf2f4d5 ---> b95300fdcc91 Removing intermediate container 063fabf2f4d5 Step 6/15 : ADD cluster-agent.zip /tmp/cluster-agent.zip ---> f06e49e5bb58 Removing intermediate container 91bb6dff87c3 Step 7/15 : ADD LICENSE /licenses/ ---> f80b38db44e5 Removing intermediate container 3846a38f6304 Step 8/15 : RUN groupadd appdynamics && useradd appdynamics -g appdynamics && mkdir -p ${CLUSTER_AGENT_HOME} && unzip -oq /tmp/cluster-agent.zip -d ${CLUSTER_AGENT_HOME} && rm /tmp/cluster-agent.zip && rm -rf /opt/appdynamics/cluster-agent/config/agent-monitoring.yml && rm -rf /opt/appdynamics/cluster-agent/config/instrumentation.yml && mkdir /opt/appdynamics/cluster-agent/config/agent-monitoring && touch /opt/appdynamics/cluster-agent/config/agent-monitoring/agent-monitoring.yml && ln -s /opt/appdynamics/cluster-agent/config/agent-monitoring/agent-monitoring.yml /opt/appdynamics/cluster-agent/config/agent-monitoring.yml && mkdir /opt/appdynamics/cluster-agent/config/instrumentation && touch /opt/appdynamics/cluster-agent/config/instrumentation/instrumentation.yml && ln -s /opt/appdynamics/cluster-agent/config/instrumentation/instrumentation.yml /opt/appdynamics/cluster-agent/config/instrumentation.yml ---> Running in d472fb9368a5 ---> 1e4176c3212a Removing intermediate container d472fb9368a5 Step 9/15 : ADD start-appdynamics ${CLUSTER_AGENT_HOME} ---> f0e50dc75e0b Removing intermediate container 7ac6a2711b39 Step 10/15 : RUN mkdir -p ${CLUSTER_AGENT_HOME}/logs && chmod 774 ${CLUSTER_AGENT_HOME}/logs && chmod 744 ${CLUSTER_AGENT_HOME}/start-appdynamics && chown -R appdynamics:appdynamics /opt/appdynamics ---> Running in 3c253fd191e4 ---> 04c464867ebb Removing intermediate container 3c253fd191e4 Step 11/15 : RUN chgrp -R 0 /opt/appdynamics && chmod -R g+w /opt/appdynamics ---> Running in ca275e7e8bbc ---> aa548b36d11d Removing intermediate container ca275e7e8bbc Step 12/15 : USER appdynamics ---> Running in 46c3b4cd2e0f ---> 204de163b46d Removing intermediate container 46c3b4cd2e0f Step 13/15 : WORKDIR ${CLUSTER_AGENT_HOME} ---> 0245415003ff Removing intermediate container 2924e7ea1503 Step 14/15 : ENTRYPOINT /bin/sh ---> Running in a72f909f7abd ---> 94653675d06b Removing intermediate container a72f909f7abd Step 15/15 : CMD -c ./start-appdynamics ---> Running in 33daebaa48cb ---> 819441b5a912 Removing intermediate container 33daebaa48cb Successfully built 819441b5a912
TEXTPush the image:
$ docker push <registryname>/<accountname>/cluster-agent:<Agent-version>
BASHFor example, pushing the image version 21.5.0 to Docker Hub registry for the account name Johndoe
:
$ docker push docker.io/johndoe/cluster-agent:21.5.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.
Log in to your Docker Hub account:
$ docker login docker.io -u <your-username> -p <your-password>
CODEPull the image:
$ docker pull docker.io/appdynamics/cluster-agent:<Agent-version>
CODEFor example, to pull the Alpine based cluster agent image version 21.5.0:
$ docker pull docker.io/appdynamics/cluster-agent:21.5.0
CODE
To push this image to another registry or accounts:
Rename the image:
$ docker tag docker.io/appdynamics/cluster-agent:<Agent-version> <registryname>/<accountname>/cluster-agent:<Agent-version>
CODEFor example:
$ docker tag docker.io/appdynamics/cluster-agent:21.5.0 docker.io/johndoe/cluster-agent:21.5.0
CODEPush the image:
$ docker push <registryname>/<accountname>/cluster-agent:<Agent-version>
CODEFor example, to push the image version 21.5.0 to Docker Hub registry for the account name Johndoe:
$ docker push docker.io/johndoe/cluster-agent:21.5.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.
Log in to Red Hat Registry using your Customer Portal credentials:
$ docker login registry.connect.redhat.com -u <your-username> -p <your-password>
CODEPull the image:
$ docker pull registry.connect.redhat.com/appdynamics/cluster-agent:<Agent-version>
CODEFor example, to pull the Rhel based Cluster Agent version 21.5.0:
$ docker pull registry.connect.redhat.com/appdynamics/cluster-agent:21.5.0
CODE
You can now use the Cluster Agent image.
To push this image to another registry, or to other accounts:
Rename the image:
$ docker tag registry.connect.redhat.com/appdynamics/cluster-agent:<Agent-version> <registryname>/<accountname>/cluster-agent:<Agent-version>
CODEFor example:
$ docker tag registry.connect.redhat.com/appdynamics/cluster-agent:21.5.0 scan.connect.redhat.com/johndoe/cluster-agent:21.5.0
CODEPush the image:
$ docker push <registryname>/<accountname>/cluster-agent:<Agent-version>
CODEFor example, to push the image version 21.5.0 to Redhat Registry for account name
johndoe
:$ docker push scan.connect.redhat.com/johndoe/cluster-agent:21.5.0
CODE
Set the Image in Cluster Agent YAML Specification
Make sure to reference the image in the cluster-agent.yaml
spec:
apiVersion: 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>
For assistance, contact AppDynamics Support.