Overview

By adding Kubernetes-specific attributes to telemetry signals, you can gain better visibility into workloads running in the cluster. Helps in correlating traces, logs and metrics with specific Kubernetes resources, such as pods, deployments, nodes and clusters. Adding resource attributes based on custom kubernetes annotations/labels can enrich the data with user defined aggregations and metadata corresponding to the originating pod that produced the telemetry.

Configuration Options

The K8sAttributes action is configured using the odigos.io/v1alpha1.Action CRD with the k8sAttributes configuration section.

Basic Example

The following example demonstrates how to collect Kubernetes attributes, including labels and annotations, and attach them to telemetry signals using the new Action CRD.
1

Create a YAML file with the following content:
k8s-attributes.yaml
apiVersion: odigos.io/v1alpha1
kind: Action
metadata:
  name: collect-k8s-attributes
  namespace: odigos-system
spec:
  actionName: "Collect Kubernetes Attributes"
  signals:
    - TRACES
    - METRICS
    - LOGS
  k8sAttributes:
    collectContainerAttributes: true
    collectWorkloadUID: true
    collectClusterUID: true
    labelsAttributes:
      - labelKey: "app.kubernetes.io/name"
        attributeKey: "app.kubernetes.name"
        from: "pod"
    annotationsAttributes:
      - annotationKey: "kubectl.kubernetes.io/restartedAt"
        attributeKey: "kubectl.kubernetes.restartedAt"
        from: "pod"
2

Apply the action to the cluster:
kubectl apply -f k8s-attributes.yaml