Install the APM Insight .NET agent in a Kubernetes environment via Dockerfile
Installing the .NET and .NET Core agents in a Kubernetes environment is similar to installing the standard .NET agent in Windows, except that you must configure the DockerFile to perform the installation.
Install the .NET agent in a Kubernetes Windows container
The following is an example of how to configure the .NET agent in a Kubernetes Windows container. You need to modify the DockerFile for the application to install and configure the agent.
FROM mcr.microsoft.com/dotnet/framework/aspnet
# Publish your application
COPY your app to be published /inetpub/wwwroot
# Download the APM Insight .NET agent installer
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;\
Invoke-WebRequest "https://staticdownloads.site24x7.com/apminsight/agents/apminsight-dotnetagent.msi" -UseBasicParsing -OutFile "apminsight-dotnetagent.msi"
# Install the APM Insight .NET agent
RUN Start-Process -Wait -FilePath msiexec -ArgumentList /i, "apminsight-dotnetagent.msi", /qn, editconfig=false, useappfilters=false, license.key=YOUR_LICENSE_KEY
# Remove the APM Insight .NET agent installer
RUN Remove-Item "apminsight-dotnetagent.msi"
# Set your application name
ENV SITE24X7_APP_NAME=YOUR_APP_NAME
Install the .NET agent in a Kubernetes Linux container
Below is an example of configuring the .NET agent in a Kubernetes Linux container.
# Use Linux-based ASP.NET runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
# Set working directory
WORKDIR /app
# Copy your published app
COPY your_app_published_folder/ . # replace with your actual published app folder path
# Use wget to download and install APM Insight agent
RUN apt-get update && \
apt-get install -y wget ca-certificates unzip && \
wget https://staticdownloads.site24x7.com/apminsight/agents/dotnet/apminsight-dotnetcoreagent-linux.sh && \
chmod +x apminsight-dotnetcoreagent-linux.sh && \
./apminsight-dotnetcoreagent-linux.sh -Destination "/opt/apminsight/dotnet" -LicenseKey "YOUR_LICENSE_KEY" && \
rm apminsight-dotnetcoreagent-linux.sh
# set the env variables for the APM Insight Agent
ENV SITE24X7_APP_NAME=YOUR_APP_NAME
ENV S247_LICENSE_KEY=YOUR_LICENSE_KEY
ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER="{9D363A5F-ED5F-4AAC-B456-75AFFA6AA0C8}"
ENV CORECLR_SITE24X7_HOME="/opt/apminsight/dotnet/ApmInsightDotNetCoreAgent"
ENV CORECLR_PROFILER_PATH_64="/opt/apminsight/dotnet/ApmInsightDotNetCoreAgent/x64/libClrProfilerAgent.so"
ENV CORECLR_PROFILER_PATH_32="/opt/apminsight/dotnet/ApmInsightDotNetCoreAgent/x86/libClrProfilerAgent.so"
ENV DOTNET_STARTUP_HOOKS="/opt/apminsight/dotnet/ApmInsightDotNetCoreAgent/netstandard2.0/DotNetAgent.Loader.dll"
ENV MANAGEENGINE_COMMUNICATION_MODE="direct"
# Expose the required for your app port (adjust if needed)
EXPOSE 80
# Set entrypoint
ENTRYPOINT ["dotnet", "your_app.dll"] # replace with your actual app DLL
- Replace YOUR_LICENSE_KEY with your actual Site24x7 APM Insight license key.
- Replace YOUR_APP_NAME with your application name.
Related articles
How to install various APM Insight agents in a Docker container
Java | .NET | PHP | Node.js | Python
How to install various APM Insight agents in a Kubernetes environment
Java | PHP | Node.js | Python
