Documentation forSolarWinds Observability

Install the SolarWinds Observability .NET Library on a Kubernetes cluster (Windows Container only)

Before you start

Do not run other APM libraries alongside the SolarWinds Observability .NET Library. Remove other APM libraries from your .NET application before using the SolarWinds Observability .NET Library.

Configure the Kubernetes pod's deployment file

When running SolarWinds Observability .NET Library inside a Kubernetes Windows Container, declare the following environment variables to allow proper Pod identification and correlation:

Environment variable Environment variable value k8s API field
SW_K8S_POD_NAMESPACE Pod's namespace metadata.namespace
SW_K8S_POD_NAME Pod's name metadata.name
SW_K8S_POD_UID Pod's UID metadata.uid

SW_K8S_* environment variables can be declared and set in the Pod's deployment file using the Kubernetes downward API. See Downward API in the Kubernetes documentation.

To declare the variables and deploy the library with the Kubernetes downward API:

  1. Install the SolarWinds Observability .NET Library inside a Kubernetes Windows Container using the installer or NuGet package.

  2. Add SW_K8S_* environment variables to pod's deployment file.

  3. Define the service key using the SW_APM_SERVICE_KEY environment variable inside pod's deployment file, in a Windows container as an environment variable set at the system level, or saved inside the solarwinds_apm.config file.

    SolarWinds recommends defining the service key in a pod's deployment file. Setting the service key in a deployment file allows you to replace the service key without building the container and reuse a service key that is defined in the deployment file across multiple deployments. It also prevents the service key from leaking when when using public containers.

  4. Redeploy the pod using the updated deployment file.

  5. Example deployment file:

    
    spec:
        ...                
        spec:
          nodeSelector:
            "kubernetes.io/os": windows
          containers:
            - name: your-instrumented-service
              image: your-container-image
            env:
              - name: SW_APM_SERVICE_KEY
                value: 'YourToken:YourServiceKey'
    
              - name: SW_K8S_POD_NAMESPACE
                valueFrom:
                  fieldRef:
                    fieldPath: metadata.namespace
                        
              - name: SW_K8S_POD_NAME
                valueFrom:
                  fieldRef:
                    fieldPath: metadata.name
    
              - name: SW_K8S_POD_UID
                valueFrom:
                  fieldRef:
                    fieldPath: metadata.uid
    

The scripts are not supported under any SolarWinds support program or service. The scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The risk arising out of the use or performance of the scripts and documentation stays with you. In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation.