OpenTelemetry Agent - .NET Linux Cluster Sidecars Installation on Alpine Container Images



Installation Wizard

To help with the installation process, vFunction offers an Installation Wizard. This Wizard provides additional information about the Prerequisites as well as steps for deploying the OpenTelemetry Agent to your environment.

Please contact support@vfunction.com or your vFunction Contact(s) for the password to start using this Wizard.


Overview

Docker Sidecars can be used for the vFunction OpenTelemetry Agent installation to separate the vFunction components from the main application.

The vFunction Docker Sidecar Installation does the following in the Deployment Manifest:

  1. Create a Shared Volume for the OpenTelemetry Agent
  2. Create an Init Container that downloads the OpenTelemetry Agent
  3. Add Environment Variables that hooks the Application with the OpenTelemetry Agent

Configuring the Deployment Manifest

Take the following steps to add a Share Volume for the OpenTelemetry Agent, creates an Init Container to download the OpenTelemetry Agent, and sets the Environment Variables to hook the Application with the OpenTelemetry Agent:

  1. Modify the Deployment Manifest for the environment
### Modify $VF_SERVER_ADDRESS with the FQDN of the vFunction Server
### Modify $VF_APP_ID with the UUID from the vFunction Server UI's Installation Instructions
apiVersion: apps/v1
kind: Deployment
metadata:
 labels:
   app: my-app
 name: my-app
spec:
 selector:
   matchLabels:
     app: my-app
 strategy:
   rollingUpdate:
     maxSurge: 1
     maxUnavailable: 0
   type: RollingUpdate
 template:
   metadata:
     labels:
       app: my-app
   spec:
     initContainers:
     - name: otel-installer
       command:
       - sh
       - -c
       - |
         cd /otel-home \
         && wget -q https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/download/v1.12.0/opentelemetry-dotnet-instrumentation-linux-musl-x64.zip \
         && unzip "opentelemetry-dotnet-instrumentation-linux-musl-x64.zip" \
         && rm "opentelemetry-dotnet-instrumentation-linux-musl-x64.zip"         
       image: alpine:latest
       imagePullPolicy: IfNotPresent
       resources: {}
       volumeMounts:
       - mountPath: /otel-home
         name: otel-home
     containers:
     - name: my-app
       env:
       - name: OTEL_EXPORTER_OTLP_PROTOCOL
         value: http/protobuf
       - name: OTEL_EXPORTER_OTLP_ENDPOINT
         value: https://$VF_SERVER_ADDRESS/api/unauth/otlp
       - name: OTEL_TRACES_EXPORTER
         value: otlp
       - name: OTEL_METRICS_EXPORTER
         value: none
       - name: OTEL_LOGS_EXPORTER
         value: none
       - name: OTEL_EXPORTER_OTLP_HEADERS
         value: X-VF-APP=$VF_APP_ID
       - name: OTEL_SERVICE_NAME
         value: $MY_SERVICE
       - name: OTEL_DOTNET_AUTO_HOME
         value: /otel-home
       - name: CORECLR_ENABLE_PROFILING
         value: "1"
       - name: CORECLR_PROFILER
         value: '{918728DD-259F-4A6A-AC2B-B85E1B658318}'
       - name: CORECLR_PROFILER_PATH
         value: $(OTEL_DOTNET_AUTO_HOME)/linux-musl-x64/OpenTelemetry.AutoInstrumentation.Native.so
       - name: DOTNET_ADDITIONAL_DEPS
         value: $(OTEL_DOTNET_AUTO_HOME)/AdditionalDeps
       - name: DOTNET_SHARED_STORE
         value: $(OTEL_DOTNET_AUTO_HOME)/store
       - name: DOTNET_STARTUP_HOOKS
         value: /otel-home/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll
       image: my-image:latest
       ports:
       - containerPort: 8080
         name: web
         protocol: TCP
       resources:
         limits:
           cpu: 500m
           memory: 800Mi
         requests:
           cpu: 100m
           memory: 500Mi
       volumeMounts:
       - mountPath: /otel-home
         name: otel-home
         readOnly: true
     dnsPolicy: ClusterFirst
     restartPolicy: Always
     terminationGracePeriodSeconds: 30
     volumes:
     - emptyDir:
         sizeLimit: 500Mi
       name: otel-home

Deploy the Application

  1. Apply the Deployment Manifest in the Cluster
  2. Confirm that the Application comes up and functions as expected
  3. If any issues arise: