Adding APM Insight .NET Agent in Kubernetes via InitContainers


The below steps will guide you through the process of integrating the APM Insight .NET agent into your Kubernetes deployment using init containers.

Step 1: Create a secret for the Applications Manager APM Insight License keu in your application namespace.

kubectl create secret generic s247licensekey --from-literal=S247_LICENSE_KEY=YOUR_LICENSE_KEY_HERE 

Note: Replace YOUR_LICENSE_KEY_HERE with the APM Insight license key from Applications Manager.

 

Step 2: Create an empty volume mount that will be used to copy the agent files during the InitContainers process.

Example:

volumeMounts:
  - name: s247dotnetcoreagent
      

 

Step 3: Include the following InitContainers command and mount the volume in both your initContainer and application container in your Helm chart or deployment YAML file.

kind: Deployment
spec:
  containers:
    - name: dotnet-app
      image: microsoft/dotnet-samples:aspnetapp
      volumeMounts:
        - mountPath: /home/APMDotNetAgent
          name: s247dotnetcoreagent
  initContainers:
    - name: init-site24x7-agent
      image: site24x7/apminsight-dotnetagent:latest
      command: ['cp', '-r', '/opt/site24x7/APMDotNetAgent', '/home']
      volumeMounts:
        - name: s247dotnetcoreagent
          mountPath: /home/APMDotNetAgent
      

 

Step 4: Add the following environment variables to your application containers:

spec:
  containers:
    - name: dotnet-app
      env:
        - name: S247_LICENSE_KEY
          valueFrom:
            secretKeyRef:
              name: s247licensekey
              key: S247_LICENSE_KEY
        - name: CORECLR_ENABLE_PROFILING
          value: "1"
        - name: CORECLR_PROFILER
          value: "{9D363A5F-ED5F-4AAC-B456-75AFFA6AA0C8}"
        - name: DOTNETCOREAGENT_HOME
          value: "/home/APMDotNetAgent"
        - name: CORECLR_PROFILER_PATH_64
          value: "/home/APMDotNetAgent/x64/libClrProfilerAgent.so"
        - name: CORECLR_PROFILER_PATH_32
          value: "/home/APMDotNetAgent/x86/libClrProfilerAgent.so"
        - name: DOTNET_STARTUP_HOOKS
          value: "/home/APMDotNetAgent/netstandard2.0/DotNetAgent.Loader.dll"
        - name: MANAGEENGINE_COMMUNICATION_MODE
          value: "direct"
        - name: SITE24X7_APP_NAME
          value: "YOUR_APM_APPLICATION_NAME"
        - name: APMINSIGHT_HOST
          value: "APPLICATIONS_MANAGER_URL"
      

 

Note:
  • Replace YOUR_APM_APPLICATION_NAME with the name you wish to assign to your application in Applications Manager.
  • Replace APPLICATIONS_MANAGER_URL with the URL of your Applications Manager server.
    Example: https://apm-prod-server:8443
    • Recommended to configure a secure APPLICATIONS_MANAGER_URL and ensure that the connection is stable and free of certificate-related issues.

Thank you for your feedback!

Was this content helpful?

We are sorry. Help us improve this page.

How can we improve this page?
Do you need assistance with this topic?
By clicking "Submit", you agree to processing of personal data according to the Privacy Policy.