K8s

Kubernetes Attributes

Kubernetes resource attributes.

Attributes:

KeyStabilityValue TypeDescriptionExample Values
k8s.cluster.nameDevelopmentstringThe name of the cluster.opentelemetry-cluster
k8s.cluster.uidDevelopmentstringA pseudo-ID for the cluster, set to the UID of the kube-system namespace. [1]218fc5a9-a5f1-4b54-aa05-46717d0ab26d
k8s.container.nameDevelopmentstringThe name of the Container from Pod specification, must be unique within a Pod. Container runtime usually uses different globally unique name (container.name).redis
k8s.container.restart_countDevelopmentintNumber of times the container was restarted. This attribute can be used to identify a particular container (running or stopped) within a container spec.
k8s.container.status.last_terminated_reasonDevelopmentstringLast terminated reason of the Container.Evicted; Error
k8s.container.status.reasonDevelopmentstringThe reason for the container state. Corresponds to the reason field of the: K8s ContainerStateWaiting or K8s ContainerStateTerminatedContainerCreating; CrashLoopBackOff; CreateContainerConfigError; ErrImagePull; ImagePullBackOff; OOMKilled; Completed; Error; ContainerCannotRun
k8s.container.status.stateDevelopmentstringThe state of the container. K8s ContainerStateterminated; running; waiting
k8s.cronjob.annotation.<key>DevelopmentstringThe cronjob annotation placed on the CronJob, the <key> being the annotation name, the value being the annotation value. [2]4; ``
k8s.cronjob.label.<key>DevelopmentstringThe label placed on the CronJob, the <key> being the label name, the value being the label value. [3]weekly; ``
k8s.cronjob.nameDevelopmentstringThe name of the CronJob.opentelemetry
k8s.cronjob.uidDevelopmentstringThe UID of the CronJob.275ecb36-5aa8-4c2a-9c47-d8bb681b9aff
k8s.daemonset.annotation.<key>DevelopmentstringThe annotation placed on the DaemonSet, the <key> being the annotation name, the value being the annotation value, even if the value is empty. [4]1; ``
k8s.daemonset.label.<key>DevelopmentstringThe label placed on the DaemonSet, the <key> being the label name, the value being the label value, even if the value is empty. [5]guestbook; ``
k8s.daemonset.nameDevelopmentstringThe name of the DaemonSet.opentelemetry
k8s.daemonset.uidDevelopmentstringThe UID of the DaemonSet.275ecb36-5aa8-4c2a-9c47-d8bb681b9aff
k8s.deployment.annotation.<key>DevelopmentstringThe annotation placed on the Deployment, the <key> being the annotation name, the value being the annotation value, even if the value is empty. [6]1; ``
k8s.deployment.label.<key>DevelopmentstringThe label placed on the Deployment, the <key> being the label name, the value being the label value, even if the value is empty. [7]guestbook; ``
k8s.deployment.nameDevelopmentstringThe name of the Deployment.opentelemetry
k8s.deployment.uidDevelopmentstringThe UID of the Deployment.275ecb36-5aa8-4c2a-9c47-d8bb681b9aff
k8s.hpa.metric.typeDevelopmentstringThe type of metric source for the horizontal pod autoscaler. [8]Resource; ContainerResource
k8s.hpa.nameDevelopmentstringThe name of the horizontal pod autoscaler.opentelemetry
k8s.hpa.scaletargetref.api_versionDevelopmentstringThe API version of the target resource to scale for the HorizontalPodAutoscaler. [9]apps/v1; autoscaling/v2
k8s.hpa.scaletargetref.kindDevelopmentstringThe kind of the target resource to scale for the HorizontalPodAutoscaler. [10]Deployment; StatefulSet
k8s.hpa.scaletargetref.nameDevelopmentstringThe name of the target resource to scale for the HorizontalPodAutoscaler. [11]my-deployment; my-statefulset
k8s.hpa.uidDevelopmentstringThe UID of the horizontal pod autoscaler.275ecb36-5aa8-4c2a-9c47-d8bb681b9aff
k8s.hugepage.sizeDevelopmentstringThe size (identifier) of the K8s huge page.2Mi
k8s.job.annotation.<key>DevelopmentstringThe annotation placed on the Job, the <key> being the annotation name, the value being the annotation value, even if the value is empty. [12]1; ``
k8s.job.label.<key>DevelopmentstringThe label placed on the Job, the <key> being the label name, the value being the label value, even if the value is empty. [13]ci; ``
k8s.job.nameDevelopmentstringThe name of the Job.opentelemetry
k8s.job.uidDevelopmentstringThe UID of the Job.275ecb36-5aa8-4c2a-9c47-d8bb681b9aff
k8s.namespace.annotation.<key>DevelopmentstringThe annotation placed on the Namespace, the <key> being the annotation name, the value being the annotation value, even if the value is empty. [14]0; ``
k8s.namespace.label.<key>DevelopmentstringThe label placed on the Namespace, the <key> being the label name, the value being the label value, even if the value is empty. [15]default; ``
k8s.namespace.nameDevelopmentstringThe name of the namespace that the pod is running in.default
k8s.namespace.phaseDevelopmentstringThe phase of the K8s namespace. [16]active; terminating
k8s.node.annotation.<key>DevelopmentstringThe annotation placed on the Node, the <key> being the annotation name, the value being the annotation value, even if the value is empty. [17]0; ``
k8s.node.condition.statusDevelopmentstringThe status of the condition, one of True, False, Unknown. [18]true; false; unknown
k8s.node.condition.typeDevelopmentstringThe condition type of a K8s Node. [19]Ready; DiskPressure
k8s.node.label.<key>DevelopmentstringThe label placed on the Node, the <key> being the label name, the value being the label value, even if the value is empty. [20]arm64; ``
k8s.node.nameDevelopmentstringThe name of the Node.node-1
k8s.node.uidDevelopmentstringThe UID of the Node.1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2
k8s.pod.annotation.<key>DevelopmentstringThe annotation placed on the Pod, the <key> being the annotation name, the value being the annotation value. [21]true; x64; ``
k8s.pod.label.<key>DevelopmentstringThe label placed on the Pod, the <key> being the label name, the value being the label value. [22]my-app; x64; ``
k8s.pod.nameDevelopmentstringThe name of the Pod.opentelemetry-pod-autoconf
k8s.pod.status.phaseDevelopmentstringThe phase for the pod. Corresponds to the phase field of the: K8s PodStatusPending; Running
k8s.pod.status.reasonDevelopmentstringThe reason for the pod state. Corresponds to the reason field of the: K8s PodStatusEvicted; NodeAffinity
k8s.pod.uidDevelopmentstringThe UID of the Pod.275ecb36-5aa8-4c2a-9c47-d8bb681b9aff
k8s.replicaset.annotation.<key>DevelopmentstringThe annotation placed on the ReplicaSet, the <key> being the annotation name, the value being the annotation value, even if the value is empty. [23]0; ``
k8s.replicaset.label.<key>DevelopmentstringThe label placed on the ReplicaSet, the <key> being the label name, the value being the label value, even if the value is empty. [24]guestbook; ``
k8s.replicaset.nameDevelopmentstringThe name of the ReplicaSet.opentelemetry
k8s.replicaset.uidDevelopmentstringThe UID of the ReplicaSet.275ecb36-5aa8-4c2a-9c47-d8bb681b9aff
k8s.replicationcontroller.nameDevelopmentstringThe name of the replication controller.opentelemetry
k8s.replicationcontroller.uidDevelopmentstringThe UID of the replication controller.275ecb36-5aa8-4c2a-9c47-d8bb681b9aff
k8s.resourcequota.nameDevelopmentstringThe name of the resource quota.opentelemetry
k8s.resourcequota.resource_nameDevelopmentstringThe name of the K8s resource a resource quota defines. [25]count/replicationcontrollers
k8s.resourcequota.uidDevelopmentstringThe UID of the resource quota.275ecb36-5aa8-4c2a-9c47-d8bb681b9aff
k8s.statefulset.annotation.<key>DevelopmentstringThe annotation placed on the StatefulSet, the <key> being the annotation name, the value being the annotation value, even if the value is empty. [26]1; ``
k8s.statefulset.label.<key>DevelopmentstringThe label placed on the StatefulSet, the <key> being the label name, the value being the label value, even if the value is empty. [27]guestbook; ``
k8s.statefulset.nameDevelopmentstringThe name of the StatefulSet.opentelemetry
k8s.statefulset.uidDevelopmentstringThe UID of the StatefulSet.275ecb36-5aa8-4c2a-9c47-d8bb681b9aff
k8s.storageclass.nameDevelopmentstringThe name of K8s StorageClass object.gold.storageclass.storage.k8s.io
k8s.volume.nameDevelopmentstringThe name of the K8s volume.volume0
k8s.volume.typeDevelopmentstringThe type of the K8s volume.emptyDir; persistentVolumeClaim

[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.cronjob.annotation.<key>: Examples:

  • An annotation retries with value 4 SHOULD be recorded as the k8s.cronjob.annotation.retries attribute with value "4".
  • An annotation data with empty string value SHOULD be recorded as the k8s.cronjob.annotation.data attribute with value "".

[3] k8s.cronjob.label.<key>: Examples:

  • A label type with value weekly SHOULD be recorded as the k8s.cronjob.label.type attribute with value "weekly".
  • A label automated with empty string value SHOULD be recorded as the k8s.cronjob.label.automated attribute with value "".

[4] k8s.daemonset.annotation.<key>: Examples:

  • A label replicas with value 1 SHOULD be recorded as the k8s.daemonset.annotation.replicas attribute with value "1".
  • A label data with empty string value SHOULD be recorded as the k8s.daemonset.annotation.data attribute with value "".

[5] k8s.daemonset.label.<key>: Examples:

  • A label app with value guestbook SHOULD be recorded as the k8s.daemonset.label.app attribute with value "guestbook".
  • A label data with empty string value SHOULD be recorded as the k8s.daemonset.label.injected attribute with value "".

[6] k8s.deployment.annotation.<key>: Examples:

  • A label replicas with value 1 SHOULD be recorded as the k8s.deployment.annotation.replicas attribute with value "1".
  • A label data with empty string value SHOULD be recorded as the k8s.deployment.annotation.data attribute with value "".

[7] k8s.deployment.label.<key>: Examples:

  • A label replicas with value 0 SHOULD be recorded as the k8s.deployment.label.app attribute with value "guestbook".
  • A label injected with empty string value SHOULD be recorded as the k8s.deployment.label.injected attribute with value "".

[8] k8s.hpa.metric.type: This attribute reflects the type field of spec.metrics[] in the HPA.

[9] k8s.hpa.scaletargetref.api_version: This maps to the apiVersion field in the scaleTargetRef of the HPA spec.

[10] k8s.hpa.scaletargetref.kind: This maps to the kind field in the scaleTargetRef of the HPA spec.

[11] k8s.hpa.scaletargetref.name: This maps to the name field in the scaleTargetRef of the HPA spec.

[12] k8s.job.annotation.<key>: Examples:

  • A label number with value 1 SHOULD be recorded as the k8s.job.annotation.number attribute with value "1".
  • A label data with empty string value SHOULD be recorded as the k8s.job.annotation.data attribute with value "".

[13] k8s.job.label.<key>: Examples:

  • A label jobtype with value ci SHOULD be recorded as the k8s.job.label.jobtype attribute with value "ci".
  • A label data with empty string value SHOULD be recorded as the k8s.job.label.automated attribute with value "".

[14] k8s.namespace.annotation.<key>: Examples:

  • A label ttl with value 0 SHOULD be recorded as the k8s.namespace.annotation.ttl attribute with value "0".
  • A label data with empty string value SHOULD be recorded as the k8s.namespace.annotation.data attribute with value "".

[15] k8s.namespace.label.<key>: Examples:

  • A label kubernetes.io/metadata.name with value default SHOULD be recorded as the k8s.namespace.label.kubernetes.io/metadata.name attribute with value "default".
  • A label data with empty string value SHOULD be recorded as the k8s.namespace.label.data attribute with value "".

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

[17] k8s.node.annotation.<key>: Examples:

  • An annotation node.alpha.kubernetes.io/ttl with value 0 SHOULD be recorded as the k8s.node.annotation.node.alpha.kubernetes.io/ttl attribute with value "0".
  • An annotation data with empty string value SHOULD be recorded as the k8s.node.annotation.data attribute with value "".

[18] k8s.node.condition.status: This attribute aligns with the status field of the NodeCondition

[19] k8s.node.condition.type: K8s Node conditions as described by K8s documentation.

This attribute aligns with the type field of the NodeCondition

The set of possible values is not limited to those listed here. Managed Kubernetes environments, or custom controllers MAY introduce additional node condition types. When this occurs, the exact value as reported by the Kubernetes API SHOULD be used.

[20] k8s.node.label.<key>: Examples:

  • A label kubernetes.io/arch with value arm64 SHOULD be recorded as the k8s.node.label.kubernetes.io/arch attribute with value "arm64".
  • A label data with empty string value SHOULD be recorded as the k8s.node.label.data attribute with value "".

[21] k8s.pod.annotation.<key>: Examples:

  • An annotation kubernetes.io/enforce-mountable-secrets with value true SHOULD be recorded as the k8s.pod.annotation.kubernetes.io/enforce-mountable-secrets attribute with value "true".
  • An annotation mycompany.io/arch with value x64 SHOULD be recorded as the k8s.pod.annotation.mycompany.io/arch attribute with value "x64".
  • An annotation data with empty string value SHOULD be recorded as the k8s.pod.annotation.data attribute with value "".

[22] k8s.pod.label.<key>: Examples:

  • A label app with value my-app SHOULD be recorded as the k8s.pod.label.app attribute with value "my-app".
  • A label mycompany.io/arch with value x64 SHOULD be recorded as the k8s.pod.label.mycompany.io/arch attribute with value "x64".
  • A label data with empty string value SHOULD be recorded as the k8s.pod.label.data attribute with value "".

[23] k8s.replicaset.annotation.<key>: Examples:

  • A label replicas with value 0 SHOULD be recorded as the k8s.replicaset.annotation.replicas attribute with value "0".
  • A label data with empty string value SHOULD be recorded as the k8s.replicaset.annotation.data attribute with value "".

[24] k8s.replicaset.label.<key>: Examples:

  • A label app with value guestbook SHOULD be recorded as the k8s.replicaset.label.app attribute with value "guestbook".
  • A label injected with empty string value SHOULD be recorded as the k8s.replicaset.label.injected attribute with value "".

[25] k8s.resourcequota.resource_name: The value for this attribute can be either the full count/<resource>[.<group>] string (e.g., count/deployments.apps, count/pods), or, for certain core Kubernetes resources, just the resource name (e.g., pods, services, configmaps). Both forms are supported by Kubernetes for object count quotas. See Kubernetes Resource Quotas documentation for more details.

[26] k8s.statefulset.annotation.<key>: Examples:

  • A label replicas with value 1 SHOULD be recorded as the k8s.statefulset.annotation.replicas attribute with value "1".
  • A label data with empty string value SHOULD be recorded as the k8s.statefulset.annotation.data attribute with value "".

[27] k8s.statefulset.label.<key>: Examples:

  • A label replicas with value 0 SHOULD be recorded as the k8s.statefulset.label.app attribute with value "guestbook".
  • A label injected with empty string value SHOULD be recorded as the k8s.statefulset.label.injected attribute with value "".

k8s.container.status.reason 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
CompletedThe container has completed execution.Development
ContainerCannotRunThe container cannot run.Development
ContainerCreatingThe container is being created.Development
CrashLoopBackOffThe container is in a crash loop back off state.Development
CreateContainerConfigErrorThere was an error creating the container configuration.Development
ErrImagePullThere was an error pulling the container image.Development
ErrorThere was an error with the container.Development
ImagePullBackOffThe container image pull is in back off state.Development
OOMKilledThe container was killed due to out of memory.Development

k8s.container.status.state 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
runningThe container is running.Development
terminatedThe container has terminated.Development
waitingThe container is waiting.Development

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.node.condition.status 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
falsecondition_falseDevelopment
truecondition_trueDevelopment
unknowncondition_unknownDevelopment

k8s.node.condition.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
DiskPressurePressure exists on the disk size—that is, if the disk capacity is lowDevelopment
MemoryPressurePressure exists on the node memory—that is, if the node memory is lowDevelopment
NetworkUnavailableThe network for the node is not correctly configuredDevelopment
PIDPressurePressure exists on the processes—that is, if there are too many processes on the nodeDevelopment
ReadyThe node is healthy and ready to accept podsDevelopment

k8s.pod.status.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
FailedAll containers in the pod have terminated, and at least one container has terminated in a failure (exited with a non-zero exit code or was stopped by the system).Development
PendingThe pod has been accepted by the system, but one or more of the containers has not been started. This includes time before being bound to a node, as well as time spent pulling images onto the host.Development
RunningThe pod has been bound to a node and all of the containers have been started. At least one container is still running or is in the process of being restarted.Development
SucceededAll containers in the pod have voluntarily terminated with a container exit code of 0, and the system is not going to restart any of these containers.Development
UnknownFor some reason the state of the pod could not be obtained, typically due to an error in communicating with the host of the pod.Development

k8s.pod.status.reason 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
EvictedThe pod is evicted.Development
NodeAffinityThe pod is in a status because of its node affinityDevelopment
NodeLostThe reason on a pod when its state cannot be confirmed as kubelet is unresponsive on the node it is (was) running.Development
ShutdownThe node is shutdownDevelopment
UnexpectedAdmissionErrorThe pod was rejected admission to the node because of an error during admission that could not be categorized.Development

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.

Attributes:

KeyStabilityValue TypeDescriptionExample Values
k8s.pod.labels.<key>Deprecated
Replaced by k8s.pod.label.
stringDeprecated, use k8s.pod.label instead.my-app