Use Kubernetes Init Containers

Note: This scenario applies to containers running in Kubernetes.

This option uses Kubernetes init containers to copy the agent binaries into the application container. It is the recommended option when Auto-Instrumentation is not possible. In this use case, it assumes there are two containers:

  • Application image is built without any Java Agent binaries.
  • Second init container image is built and only contains the Java Agent binaries.

The deployment spec for the application is configured to copy the agent binaries to the running application container. To use init containers to copy the agent binaries:

  1. Build the Java Application Image
  2. Build the Java Agent Init Container Image
  3. Redirect Agent Output to Stdout
  4. Add the Init Container to the Deployment Spec
  5. Set the Java Agent Environment Variables
  6. Add the -javaagent Argument to the Deployment Spec
  7. (OpenShift only) Set the APPDYNAMICS_AGENT_UNIQUE_HOST_ID Environment Variable
  8. (On-Premises Controller only) Copy the Controller Certificates to the Container