Extract cgroupv2 Container ID Using Kubernetes API Server

  1. Install Java Agent version 23.9.0 or later.
  2. Associate the application pod with a service account.
    Ensure that the service account has GET permission for Kubernetes resource pods. If a service account is already associated with the pod, create a new role and role binding. See Sample YAML. If an IAM role is bound to the service account, create a new policy to allow access. It is required because Kubernetes does not permit access to resource pods without the necessary permissions, and the Java agent cannot extract the cgroupv2 container-ID without this access.
  3. Set the following property or environmental variable to kubeapi.
    Element in controller-info.xml N/A
    System Property -Dappdynamics.containerinfo.fetch.service
    Environment Variable APPDYNAMICS_CONTAINERINFO_FETCH_SERVICE
    Type String
    Default None
    Example -Dappdynamics.containerinfo.fetch.service=kubeapi
  4. Set the following property or environmental variable to specify the target container name.
    Element in controller-info.xml N/A
    System Property -Dappdynamics.container.name
    Environment Variable APPDYNAMICS_CONTAINER_NAME
    Type String
    Default None
    Example -Dappdynamics.container.name=<target-container-name>