overexchange
overexchange

Reputation: 1

Is Pod UID unique across multiple k8s clusters?

As mentioned here,

A Kubernetes systems-generated string to uniquely identify objects. Every object created over the whole lifetime of a Kubernetes cluster has a distinct UID. It is intended to distinguish between historical occurrences of similar entities.


We have multiple k8s clusters in GCP

Each k8s cluster has multiple namespace.

Each namespace has multiple pods


Using kubernetes API, We monitor Pod health(Podname, ready, status, restarts, age, Podnamespace) from each namespace of each K8s clusters and store data in MongoDB document.

Goal is to make unique entry of each Pod in a MongoDB document


Is Pod UID a unique id across multiple K8s cluster? if no, what is the best primary key to store Pod entry in a MongoDB document?

Upvotes: 0

Views: 719

Answers (1)

P Ekambaram
P Ekambaram

Reputation: 17689

Every object created over the whole lifetime of a Kubernetes cluster has a distinct UID. It is intended to distinguish between historical occurrences of similar entities. But there is no guarantee it would stay unique across clusters.

Can you consider the cluster name and pod UID combination as the primary key in the database table to identify specific pod in a cluster.

Upvotes: 2

Related Questions