Skip to main content

K8s Attributes Processor

Overview​

The Kubernetes Attributes Processor enriches telemetry data (logs, metrics, and traces) with Kubernetes metadata by querying the Kubernetes API.

Supported types: Logs · Metrics · Traces

Note: This processor is designed to run in Kubernetes environments. Support depends on Kubernetes deployment rather than the host OS.

Authentication​

ParameterTypeDescription
auth_typestringAuthentication method for accessing Kubernetes API. Supported values include serviceAccount (default, for in-cluster usage) and kubeConfig (for external access).

Metadata Extraction​

ParameterTypeDefault ValueRequiredDescription
extract.metadataarraypredefined setNoList of Kubernetes metadata fields to extract (e.g., k8s.pod.name, k8s.namespace.name, k8s.node.name, etc.).
extract.otel_annotationsbooleanfalseNoExtract pod annotations with prefix resource.opentelemetry.io/ as resource attributes.
extract.deployment_name_from_replicasetbooleanfalseNoDerives deployment name from replicaset by removing pod template hash suffix.

Labels​

Defines how Kubernetes labels are extracted and mapped to telemetry attributes.

ParameterTypeDefault ValueRequiredDescription
keystringnoneConditionalExact label key to extract.
key_regexstringnoneConditionalRegex pattern to match multiple label keys.
tag_namestringnoneNoRename the extracted label to a custom attribute name.
fromstringpodNoSource resource for labels (pod, namespace, node, deployment, statefulset, daemonset, job).

Annotations​

Defines how Kubernetes Annotations are extracted and mapped to telemetry attributes.

ParameterTypeDefault ValueRequiredDescription
keystringnoneConditionalExact Annotation key to extract.
key_regexstringnoneConditionalRegex pattern to match multiple Annotation keys.
tag_namestringnoneNoRename the extracted Annotation to a custom attribute name.
fromstringpodNoSource resource for labels (pod, namespace, node, deployment, statefulset, daemonset, job).

Filter Configuration​

ParameterTypeDefault ValueRequiredDescription
namespacestringnoneNoOnly process telemetry from pods in this namespace.
nodestringnoneNoOnly process telemetry from pods running on this node.
node_from_env_varstringnoneNoReads node name from environment variable (commonly K8S_NODE_NAME).
fieldsarray[]NoFilter pods using Kubernetes field selectors.
labelsarray[]NoFilter pods using label selectors.

Pod Association​

Defines how incoming telemetry is matched to Kubernetes pods.

ParameterTypeDefault ValueRequiredDescription
sourcesarraynoneYesOrdered list of sources used to associate telemetry with a pod.

Common association sources:

  • resource_attribute (e.g., k8s.pod.ip, k8s.pod.uid)
  • connection (uses client IP)

Exclude Configuration​

ParameterTypeDefault ValueRequiredDescription
exclude.podsarray[]NoList of pod names to exclude from processing.

Metadata Sync​

ParameterTypeDefault ValueRequiredDescription
wait_for_metadatabooleanfalseNoWait until Kubernetes metadata is fully synced before processing telemetry.
wait_for_metadata_timeoutstring1mNoMaximum duration to wait for metadata synchronization.

Advanced Settings​

ParameterTypeDefault ValueRequiredDescription
passthroughbooleanfalseNoIf enabled, skips metadata enrichment and passes data through unchanged.

Example Configuration​

{
"auth_type": "serviceAccount", // default: "serviceAccount"

"extract": {
"metadata": ["k8s.pod.name", "k8s.namespace.name", "k8s.node.name"],
"otel_annotations": false,
"deployment_name_from_replicaset": true,
},

"filter": {
"namespace": "production",
},

"pod_association": [
{
"sources": [
{
"from": "resource_attribute",
"name": "k8s.pod.ip",
},
{
"from": "connection",
},
],
},
],

"exclude": {
"pods": ["test-pod"],
},

"wait_for_metadata": false,
"wait_for_metadata_timeout": "1m",

"passthrough": false,
}