Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit 8ef0cdb

Browse files
Merge pull request #2728 from splunk/kopta_dotnet_agent_in_Kubernetes
Deploy the .NET agent in Kubernetes added
2 parents 836e186 + 4f5e60f commit 8ef0cdb

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

gdi/get-data-in/application/otel-dotnet/instrumentation/instrument-dotnet-application.rst

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,64 @@ To install the .NET zero-code instrumentation on Windows hosts that are offline,
404404
405405
Install-OpenTelemetryCore -LocalPath "C:\Users\Administrator\Downloads\splunk-opentelemetry-dotnet-windows.zip"
406406
407+
408+
Deploy the .NET zero-code instrumentation in Kubernetes
409+
----------------------------------------------------------
410+
411+
To deploy the .NET zero-code instrumentation in Kubernetes, follow these steps:
412+
413+
#. Build a Docker image by following the instructions for configuring instrumentation with the NuGet package for Linux or Windows.
414+
Refer to :ref:`otel-dotnet-nuget-pkg`.
415+
416+
#. Modify the Entrypoint to adjust it to call the appropriate script based on your operating system:
417+
418+
**For Linux:**
419+
420+
.. code-block:: shell
421+
422+
splunk-launch.sh dotnet <application>.
423+
424+
**For Windows:**
425+
426+
.. code-block:: powershell
427+
428+
splunk-launch.cmd dotnet <application>.
429+
430+
Example:
431+
432+
.. code-block:: docker
433+
434+
ENTRYPOINT ["./splunk-launch.sh", "dotnet", "myapp.dll"]
435+
436+
#. Configure the Kubernetes Downward API to expose environment variables to Kubernetes resources. The following example demonstrates how to update a deployment to expose environment variables by adding the agent configuration under the ``.spec.template.spec.containers.env`` section:
437+
438+
.. code-block:: yaml
439+
440+
apiVersion: apps/v1
441+
kind: Deployment
442+
spec:
443+
selector:
444+
matchLabels:
445+
app: your-application
446+
template:
447+
spec:
448+
containers:
449+
- name: myapp
450+
env:
451+
- name: SPLUNK_OTEL_AGENT
452+
valueFrom:
453+
fieldRef:
454+
fieldPath: status.hostIP
455+
- name: OTEL_EXPORTER_OTLP_ENDPOINT
456+
value: "http://$(SPLUNK_OTEL_AGENT):4318"
457+
- name: OTEL_SERVICE_NAME
458+
value: "<serviceName>"
459+
- name: OTEL_RESOURCE_ATTRIBUTES
460+
value: "deployment.environment=<environmentName>"
461+
462+
Based on the Collector deployment mode, modify the deployment manifest, setting the correct value for ``OTEL_EXPORTER_OTLP_ENDPOINT`` environment variable. In case of daemonset deployment mode, Kubernetes Downward API can be used to obtain an address of a collector.
463+
464+
.. note:: You can also deploy instrumentation using the Kubernetes Operator. See :ref:`k8s-backend-auto-discovery` for more information.
407465
.. _export-directly-to-olly-cloud-dotnet-otel:
408466

409467
Send data directly to Splunk Observability Cloud

0 commit comments

Comments
 (0)