Kubesense

OTEL

Ingesting OTEL Traces & Logs with KubeSense

KubeSense offers full support for the ingestion of OpenTelemetry (OTEL) traces, and it displays them natively in our user interface for easy visualization and analysis.

Ingestion from Kubernetes Pods

You can ingest OTLP traces generated by your services directly into KubeSense via our DaemonSet Sensor. This is achieved by configuring the exporter endpoint to the kubeSensor Service Endpoint, which automatically enriches the received spans and logs with relevant Kubernetes metadata.

Locating the KubeSense Sensor Service Endpoint

To find the endpoint for the Sensor service (referred to as {KUBESENSOR_HOST}), follow the instructions provided here.

Configuring the Required Environment Variables

To enable the shipping of OTEL data to KubeSense, you need to apply the following environment variables to your services:

Environment Variables:

env:
  - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
    value: "http://{KUBECOL_HOST}:33443/v1/traces"
  - name: OTEL_EXPORTER_OTLP_LOGS_ENDPOINT
    value: "http://{AGGREGATOR_HOST}:30055/v1/logs"
  - name: OTEL_RESOURCE_ATTRIBUTES
    value: "kubesense.env_type=(k8s|docker|legacy),kubesense.cluster={CLUSTER_NAME}"

Note: Additional setup is required, and in most scenarios, ingesting OTLP logs from within your Kubernetes cluster is not recommended, as it could lead to log duplication.

Automatic Attribute Enrichment

KubeSense automatically enriches the traces with valuable Kubernetes metadata to provide more context for your observability needs.

Forwarding Traces from an OpenTelemetry Collector Inside Kubernetes

To forward OTEL data from an OpenTelemetry Collector inside Kubernetes, configure the following exporter and pipelines:

Exporter Configuration:

exporters:
  otlphttp/kubesense_traces:
    endpoint: http://{KUBECOL_HOST}:33443
  otlphttp/kubesense_logs:
    endpoint: http://{AGGREGATOR_HOST}:30055

To directly add custom resource attribute from otel collector.

Processor Configuration:

processors:
  resource:
    attributes:
    - action: insert
      key: kubesense.cluster
      value: {CLUSTER_NAME}
    - action: insert
      key: kubesense.env_type
      value: (k8s|docker|legacy)

Traces Pipeline:

pipelines:
  traces:
    exporters:
    - otlphttp/kubesense_traces
    processors:
    - resource
  logs:
    exporters:
    - otlphttp/kubesense_logs
    processors:
    - resource