What Is the Purpose of the Pod Status Field?

0
2
Asked By VelvetCactus42 On

I'm trying to understand the status section in a Kubernetes Pod definition. Is status only meant for existing Pods rather than something used when creating or updating one? Is the kubelet responsible for updating it? If I export a live Pod with `kubectl get pod mypod -o yaml` and then apply that file, will Kubernetes ignore the copied status values?

2 Answers

Answered By MellowRidge7 On

Think of `spec` as the desired state—what you want Kubernetes to create—and `status` as the observed state of what is actually happening. For Pods, the kubelet and other control-plane components populate fields such as phase, conditions, pod IP, and container statuses after the Pod exists. Normal create and update requests do not use the status you provide; status is managed through the separate `/status` subresource.

Answered By CopperLynx88 On

Yes, applying an exported Pod YAML will not restore values like `phase: Running` or the current container statuses. Those are recalculated from the live cluster state. Also, `kubectl get -o yaml` produces a live API object rather than a clean reusable manifest, so when reusing it, remove `status` and server-managed metadata such as `uid`, `resourceVersion`, `creationTimestamp`, and `managedFields`.

QuietOrbit31 -

Status can technically be changed through an explicit request to the status subresource, but ordinary users should treat it as controller-owned and effectively read-only.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.