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?

                      • Related Articles

                      • How to add an APM Insight Python agent in Kubernetes via InitContainers?

                        Adding the APM Insight Python agent via init containers in Kubernetes enables the seamless integration of performance monitoring for Python applications, ensuring efficient tracking and analysis of application behavior within the Kubernetes ...
                      • How to add an APM Insight Node.js agent in Kubernetes via InitContainers?

                        To integrate the APM Insight Node.js agent into your Kubernetes applications using InitContainers, follow the steps given below: Step 1: Create an empty volume that will be used to copy the agent files during the initContainers process. Example: ...
                      • Adding APM Insight Java agent in a Kubernetes environment

                        There are three methods for installing the APM Insight Java agent in a Kubernetes environment: Using Dockerfile Using InitContainers Using Persistent Volumes Prerequisites Download the latest APM Insight Java agent ZIP file. Extract the ZIP file and ...
                      • How to add an APM Insight Java agent in Kubernetes via InitContainers?

                        Step 1. Create a secret to access the APM Insight license key in your application namespace: kubectl create secret generic app-secret --from-literal=s247licensekey='your_APMInsight_license_key' -n petclinic The license key can be obtained from the ...
                      • Uninstrumented Block of Code - APM Insight

                        In the traces tab --> Slowest Method Calls and Count we show if you find Un-instrumented block of code the reason is as follows: Basically, What is un-instrumented block of code in APM Insight? By default, APM Insight agent monitors known frameworks ...