# Installing APM Agent for .NET App on OpenShift

**URL:** <https://discuss.elastic.co/t/installing-apm-agent-for-net-app-on-openshift/386876>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [June 16, 2026, 9:43am UTC](https://discuss.elastic.co/t/installing-apm-agent-for-net-app-on-openshift/386876 "2026-06-16T09:43:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Umut](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/umut/32/147682_2.png) [@Umut](https://discuss.elastic.co/u/Umut)\
**Post date:** [June 16, 2026, 9:43am UTC](https://discuss.elastic.co/t/installing-apm-agent-for-net-app-on-openshift/386876/1 "2026-06-16T09:43:21Z")

</div>

Hello,

I want to install an APM agent on a .NET application running on OpenShift.

How can I do it?

Thanks.

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [June 16, 2026, 9:47am UTC](https://discuss.elastic.co/t/installing-apm-agent-for-net-app-on-openshift/386876/2 "2026-06-16T09:47:58Z")

</div>

Welcome @Umut!

Are you deploying your app on OpenShift via Kubernetes? I'm not an OpenShift expert but I would have assumed adding the agent to the manifest and [adding the required permissions as documented here](https://www.elastic.co/docs/deploy-manage/deploy/cloud-on-k8s/k8s-openshift-agent).

Let us know if that helps!

---

<div class="post-metadata">

**Author:** ![stevejgordon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stevejgordon/32/80912_2.png) [@stevejgordon](https://discuss.elastic.co/u/stevejgordon)\
**Post date:** [June 16, 2026, 12:07pm UTC](https://discuss.elastic.co/t/installing-apm-agent-for-net-app-on-openshift/386876/3 "2026-06-16T12:07:07Z")

</div>

Hi Umut,

I'm also not familiar with using OpenShift, but for .NET on OpenShift (which is Kubernetes under the hood), I believe the recommended zero-code-change approach is profiler-based auto-instrumentation via an init container, the same as when using k8s directly.

We publish a purpose-built init container image at [docker.elastic.co/observability/apm-agent-dotnet:](http://docker.elastic.co/observability/apm-agent-dotnet:) that contains just the profiler binaries. The init container copies those files into a shared emptyDir volume that your application container then reads at startup.

Here is a minimal Deployment manifest that may work as an example:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: your-app
spec:
  template:
    spec:
      initContainers:
        - name: elastic-apm-agent
          image: docker.elastic.co/observability/apm-agent-dotnet:1.34.3
          command: ['sh', '-c', 'cp -r /usr/agent/apm-dotnet-agent/. /elastic-apm-agent/']
          volumeMounts:
            - name: elastic-apm-agent
              mountPath: /elastic-apm-agent
      containers:
        - name: your-app
          image: your-image
          env:
            - name: CORECLR_ENABLE_PROFILING
              value: "1"
            - name: CORECLR_PROFILER
              value: "{FA65FE15-F085-4681-9B20-95E04F6C03CC}"
            - name: CORECLR_PROFILER_PATH
              value: "/elastic-apm-agent/libelastic_apm_profiler.so"
            - name: ELASTIC_APM_PROFILER_HOME
              value: "/elastic-apm-agent"
            - name: ELASTIC_APM_PROFILER_INTEGRATIONS
              value: "/elastic-apm-agent/integrations.yml"
            - name: ELASTIC_APM_SERVICE_NAME
              value: "your-service-name"
            - name: ELASTIC_APM_SERVER_URL
              valueFrom:
                secretKeyRef:
                  name: elastic-apm-secret
                  key: server-url
            - name: ELASTIC_APM_API_KEY
              valueFrom:
                secretKeyRef:
                  name: elastic-apm-secret
                  key: api-key
          volumeMounts:
            - name: elastic-apm-agent
              mountPath: /elastic-apm-agent
      volumes:
        - name: elastic-apm-agent
          emptyDir: {}

```

Create the secret beforehand using the OpenShift CLI:

```bash
oc create secret generic elastic-apm-secret \
  --from-literal=server-url=https://your-apm-server:8200 \
  --from-literal=api-key=your-api-key

```

We don't explicitly test against OpenShift, so the above is generalised guidance based on the underlying Kubernetes behaviour.

**Alternative:** bake the profiler into your image(s)

If you prefer not to use an init container, you can include the profiler directly in your application image using a multi-stage Docker build. See the Docker containers section of the auto-instrumentation [setup docs](https://www.elastic.co/docs/reference/apm/agents/dotnet/setup-auto-instrumentation#docker-containers).

If you run into any issues specific to OpenShift, please do share the details as it could help us improve our guidance.
