Adding APM Insight .NET agent in Kubernetes via InitContainers

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. 

  1. Create a secret for the Applications Manager Apminsight license key in your application namespace
    1. kubectl create secret generic s247licensekey --fromliteral=S247_LICENSE_KEY=YOUR_LICENSE_KEY_HERE

    Note:
    Replace YOUR_LICENSE_KEY_HERE with the appropriate apminsight license key value from the Applications Manager  console.


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

      Example:

      1. volumeMounts: 
      2.       - name: s247dotnetcoreagent

    2. Include the following InitContainers command and mount the volume in both initContainer and your application container in your helm chart/deployment YAML file:

      1. kind: Deployment
      2.   spec:
      3.     containers:
      4.       - name: dotnet-app
      5.         image: microsoft/dotnet-samples:aspnetapp 
      6.         volumeMounts:
      7.           - mountPath: /home/APMDotNetAgent
      8.             name: s247dotnetcoreagent 
      9.     initContainers:
      10.       - name: init-site24x7-agent
      11.         image: site24x7/apminsight-dotnetagent:latest
      12.         command: ['cp', '-r', '/opt/site24x7/APMDotNetAgent', '/home'] 
      13.         volumeMounts: 
      14.           - name: s247dotnetcoreagent 
      15.             mountPath: /home/APMDotNetAgent

    3. Add the following environment variables to application containers.

      1. spec:  
      2.   containers:
      3.     - name: dotnet-app
      4.       env:    
      5.         - name: S247_LICENSE_KEY
      6.           valueFrom:
      7.             secretKeyRef: 
      8.               name: s247licensekey
      9.               key: S247_LICENSE_KEY
      10.         - name: CORECLR_ENABLE_PROFILING
      11.           value: "1"
      12.         - name: CORECLR_PROFILER
      13.           value: "{9D363A5F-ED5F-4AAC-B456-75AFFA6AA0C8}"
      14.         - name: DOTNETCOREAGENT_HOME
      15.           value: "/home/APMDotNetAgent"
      16.         - name: CORECLR_PROFILER_PATH_64 
      17.           value: "/home/APMDotNetAgent/x64/libClrProfilerAgent.so"
      18.         - name: CORECLR_PROFILER_PATH_32
      19.           value: "/home/APMDotNetAgent/x86/libClrProfilerAgent.so" 
      20.         - name: DOTNET_STARTUP_HOOKS
      21.           value: "/home/APMDotNetAgent/netstandard2.0/DotNetAgent.Loader.dll"
      22.         - name: MANAGEENGINE_COMMUNICATION_MODE
      23.           value: "direct"
      24.         - name: SITE24X7_APP_NAME
      25.         value: "YOUR_APM_APPLICATION_NAME"
      26.         - name: APMINSIGHT_HOST
      27.         value: "APPLICATIONS_MANAGER_URL"

      Note:

      Replace your application name with YOUR_APM_APPLICATION_NAME value, and apm url with APPLICATIONS_MANAGER_URL.

                    New to ADSelfService Plus?