K8s

Kubernetes Attributes

Kubernetes resource attributes.

AttributeTypeDescriptionExamplesStability
k8s.cluster.namestringThe name of the cluster.opentelemetry-clusterDevelopment
k8s.cluster.uidstringA pseudo-ID for the cluster, set to the UID of the kube-system namespace. [1]218fc5a9-a5f1-4b54-aa05-46717d0ab26dDevelopment
k8s.container.namestringThe name of the Container from Pod specification, must be unique within a Pod. Container runtime usually uses different globally unique name (container.name).redisDevelopment
k8s.container.restart_countintNumber of times the container was restarted. This attribute can be used to identify a particular container (running or stopped) within a container spec.Development
k8s.container.status.last_terminated_reasonstringLast terminated reason of the Container.Evicted; ErrorDevelopment
k8s.cronjob.namestringThe name of the CronJob.opentelemetryDevelopment
k8s.cronjob.uidstringThe UID of the CronJob.275ecb36-5aa8-4c2a-9c47-d8bb681b9affDevelopment
k8s.daemonset.namestringThe name of the DaemonSet.opentelemetryDevelopment
k8s.daemonset.uidstringThe UID of the DaemonSet.275ecb36-5aa8-4c2a-9c47-d8bb681b9affDevelopment
k8s.deployment.namestringThe name of the Deployment.opentelemetryDevelopment
k8s.deployment.uidstringThe UID of the Deployment.275ecb36-5aa8-4c2a-9c47-d8bb681b9affDevelopment
k8s.hpa.namestringThe name of the horizontal pod autoscaler.opentelemetryDevelopment
k8s.hpa.uidstringThe UID of the horizontal pod autoscaler.275ecb36-5aa8-4c2a-9c47-d8bb681b9affDevelopment
k8s.job.namestringThe name of the Job.opentelemetryDevelopment
k8s.job.uidstringThe UID of the Job.275ecb36-5aa8-4c2a-9c47-d8bb681b9affDevelopment
k8s.namespace.namestringThe name of the namespace that the pod is running in.defaultDevelopment
k8s.namespace.phasestringThe phase of the K8s namespace. [2]active; terminatingDevelopment
k8s.node.namestringThe name of the Node.node-1Development
k8s.node.uidstringThe UID of the Node.1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2Development
k8s.pod.annotation.<key>stringThe annotation key-value pairs placed on the Pod, the <key> being the annotation name, the value being the annotation value.k8s.pod.annotation.kubernetes.io/enforce-mountable-secrets=true; k8s.pod.annotation.mycompany.io/arch=x64; k8s.pod.annotation.data=Development
k8s.pod.label.<key>stringThe label key-value pairs placed on the Pod, the <key> being the label name, the value being the label value.k8s.pod.label.app=my-app; k8s.pod.label.mycompany.io/arch=x64; k8s.pod.label.data=Development
k8s.pod.namestringThe name of the Pod.opentelemetry-pod-autoconfDevelopment
k8s.pod.uidstringThe UID of the Pod.275ecb36-5aa8-4c2a-9c47-d8bb681b9affDevelopment
k8s.replicaset.namestringThe name of the ReplicaSet.opentelemetryDevelopment
k8s.replicaset.uidstringThe UID of the ReplicaSet.275ecb36-5aa8-4c2a-9c47-d8bb681b9affDevelopment
k8s.replicationcontroller.namestringThe name of the replication controller.opentelemetryDevelopment
k8s.replicationcontroller.uidstringThe UID of the replication controller.275ecb36-5aa8-4c2a-9c47-d8bb681b9affDevelopment
k8s.resourcequota.namestringThe name of the resource quota.opentelemetryDevelopment
k8s.resourcequota.uidstringThe UID of the resource quota.275ecb36-5aa8-4c2a-9c47-d8bb681b9affDevelopment
k8s.statefulset.namestringThe name of the StatefulSet.opentelemetryDevelopment
k8s.statefulset.uidstringThe UID of the StatefulSet.275ecb36-5aa8-4c2a-9c47-d8bb681b9affDevelopment
k8s.volume.namestringThe name of the K8s volume.volume0Development
k8s.volume.typestringThe type of the K8s volume.emptyDir; persistentVolumeClaimDevelopment

[1] k8s.cluster.uid: K8s doesn’t have support for obtaining a cluster ID. If this is ever added, we will recommend collecting the k8s.cluster.uid through the official APIs. In the meantime, we are able to use the uid of the kube-system namespace as a proxy for cluster ID. Read on for the rationale.

Every object created in a K8s cluster is assigned a distinct UID. The kube-system namespace is used by Kubernetes itself and will exist for the lifetime of the cluster. Using the uid of the kube-system namespace is a reasonable proxy for the K8s ClusterID as it will only change if the cluster is rebuilt. Furthermore, Kubernetes UIDs are UUIDs as standardized by ISO/IEC 9834-8 and ITU-T X.667. Which states:

If generated according to one of the mechanisms defined in Rec. ITU-T X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be different from all other UUIDs generated before 3603 A.D., or is extremely likely to be different (depending on the mechanism chosen).

Therefore, UIDs between clusters should be extremely unlikely to conflict.

[2] k8s.namespace.phase: This attribute aligns with the phase field of the K8s NamespaceStatus


k8s.namespace.phase has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

ValueDescriptionStability
activeActive namespace phase as described by K8s APIDevelopment
terminatingTerminating namespace phase as described by K8s APIDevelopment

k8s.volume.type has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

ValueDescriptionStability
configMapA configMap volumeDevelopment
downwardAPIA downwardAPI volumeDevelopment
emptyDirAn emptyDir volumeDevelopment
localA local volumeDevelopment
persistentVolumeClaimA persistentVolumeClaim volumeDevelopment
secretA secret volumeDevelopment

Deprecated Kubernetes Attributes

Describes deprecated k8s attributes.

AttributeTypeDescriptionExamplesStability
k8s.pod.labels.<key>stringDeprecated, use k8s.pod.label instead.k8s.pod.label.app=my-appDeprecated
Replaced by k8s.pod.label.