Kubernetes

Status: Experimental

Useful resources to understand Kubernetes objects and metadata:

The “name” of a Kubernetes object is unique for that type of object within a “namespace” and only at a specific moment of time (names can be reused over time). The “uid” is unique across your whole cluster, and very likely across time. Because of this it is recommended to always set the UID for every Kubernetes object, but “name” is usually more user friendly so can be also set.

Cluster

Status: Experimental

type: k8s.cluster

Description: A Kubernetes Cluster.

AttributeTypeDescriptionExamplesRequirement LevelStability
k8s.cluster.namestringThe name of the cluster.opentelemetry-clusterRecommendedExperimental
k8s.cluster.uidstringA pseudo-ID for the cluster, set to the UID of the kube-system namespace. [1]218fc5a9-a5f1-4b54-aa05-46717d0ab26dRecommendedExperimental

[1]: 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.

Node

Status: Experimental

type: k8s.node

Description: A Kubernetes Node object.

AttributeTypeDescriptionExamplesRequirement LevelStability
k8s.node.namestringThe name of the Node.node-1RecommendedExperimental
k8s.node.uidstringThe UID of the Node.1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2RecommendedExperimental

Namespace

Namespaces provide a scope for names. Names of objects need to be unique within a namespace, but not across namespaces.

Status: Experimental

type: k8s.namespace

Description: A Kubernetes Namespace.

AttributeTypeDescriptionExamplesRequirement LevelStability
k8s.namespace.namestringThe name of the namespace that the pod is running in.defaultRecommendedExperimental

Pod

The smallest and simplest Kubernetes object. A Pod represents a set of running containers on your cluster.

Status: Experimental

type: k8s.pod

Description: A Kubernetes Pod object.

AttributeTypeDescriptionExamplesRequirement LevelStability
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=RecommendedExperimental
k8s.pod.namestringThe name of the Pod.opentelemetry-pod-autoconfRecommendedExperimental
k8s.pod.uidstringThe UID of the Pod.275ecb36-5aa8-4c2a-9c47-d8bb681b9affRecommendedExperimental
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=Opt-InExperimental

Container

A container specification in a Pod template. This type is intended to be used to capture information such as name of a container in a Pod template which is different from the name of the running container.

Note: This type is different from container, which corresponds to a running container.

Status: Experimental

type: k8s.container

Description: A container in a PodTemplate.

AttributeTypeDescriptionExamplesRequirement LevelStability
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).redisRecommendedExperimental
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.RecommendedExperimental
k8s.container.status.last_terminated_reasonstringLast terminated reason of the Container.Evicted; ErrorRecommendedExperimental

ReplicaSet

Status: Experimental

type: k8s.replicaset

Description: A Kubernetes ReplicaSet object.

AttributeTypeDescriptionExamplesRequirement LevelStability
k8s.replicaset.namestringThe name of the ReplicaSet.opentelemetryRecommendedExperimental
k8s.replicaset.uidstringThe UID of the ReplicaSet.275ecb36-5aa8-4c2a-9c47-d8bb681b9affRecommendedExperimental

Deployment

An API object that manages a replicated application, typically by running Pods with no local state. Each replica is represented by a Pod, and the Pods are distributed among the nodes of a cluster.

Status: Experimental

type: k8s.deployment

Description: A Kubernetes Deployment object.

AttributeTypeDescriptionExamplesRequirement LevelStability
k8s.deployment.namestringThe name of the Deployment.opentelemetryRecommendedExperimental
k8s.deployment.uidstringThe UID of the Deployment.275ecb36-5aa8-4c2a-9c47-d8bb681b9affRecommendedExperimental

StatefulSet

Manages the deployment and scaling of a set of Pods, and provides guarantees about the ordering and uniqueness of these Pods.

Status: Experimental

type: k8s.statefulset

Description: A Kubernetes StatefulSet object.

AttributeTypeDescriptionExamplesRequirement LevelStability
k8s.statefulset.namestringThe name of the StatefulSet.opentelemetryRecommendedExperimental
k8s.statefulset.uidstringThe UID of the StatefulSet.275ecb36-5aa8-4c2a-9c47-d8bb681b9affRecommendedExperimental

DaemonSet

A DaemonSet ensures that all (or some) Nodes run a copy of a Pod.

Status: Experimental

type: k8s.daemonset

Description: A Kubernetes DaemonSet object.

AttributeTypeDescriptionExamplesRequirement LevelStability
k8s.daemonset.namestringThe name of the DaemonSet.opentelemetryRecommendedExperimental
k8s.daemonset.uidstringThe UID of the DaemonSet.275ecb36-5aa8-4c2a-9c47-d8bb681b9affRecommendedExperimental

Job

A Job creates one or more Pods and ensures that a specified number of them successfully terminate.

Status: Experimental

type: k8s.job

Description: A Kubernetes Job object.

AttributeTypeDescriptionExamplesRequirement LevelStability
k8s.job.namestringThe name of the Job.opentelemetryRecommendedExperimental
k8s.job.uidstringThe UID of the Job.275ecb36-5aa8-4c2a-9c47-d8bb681b9affRecommendedExperimental

CronJob

A CronJob creates Jobs on a repeating schedule.

Status: Experimental

type: k8s.cronjob

Description: A Kubernetes CronJob object.

AttributeTypeDescriptionExamplesRequirement LevelStability
k8s.cronjob.namestringThe name of the CronJob.opentelemetryRecommendedExperimental
k8s.cronjob.uidstringThe UID of the CronJob.275ecb36-5aa8-4c2a-9c47-d8bb681b9affRecommendedExperimental