@@ -11,6 +11,19 @@ in the `Pending` [phase](#pod-phase), moving through `Running` if at least one
11
11
of its primary containers starts OK, and then through either the ` Succeeded ` or
12
12
` Failed ` phases depending on whether any container in the Pod terminated in failure.
13
13
14
+ Like individual application containers, Pods are considered to be relatively
15
+ ephemeral (rather than durable) entities. Pods are created, assigned a unique
16
+ ID ([ UID] ( /docs/concepts/overview/working-with-objects/names/#uids ) ), and scheduled
17
+ to run on nodes where they remain until termination (according to restart policy) or
18
+ deletion.
19
+ If a {{< glossary_tooltip term_id="node" >}} dies, the Pods running on (or scheduled
20
+ to run on) that node are [ marked for deletion] ( #pod-garbage-collection ) . The control
21
+ plane marks the Pods for removal after a timeout period.
22
+
23
+ <!-- body -->
24
+
25
+ ## Pod lifetime
26
+
14
27
Whilst a Pod is running, the kubelet is able to restart containers to handle some
15
28
kind of faults. Within a Pod, Kubernetes tracks different container
16
29
[ states] ( #container-states ) and determines what action to take to make the Pod
@@ -21,32 +34,48 @@ status for a Pod object consists of a set of [Pod conditions](#pod-conditions).
21
34
You can also inject [ custom readiness information] ( #pod-readiness-gate ) into the
22
35
condition data for a Pod, if that is useful to your application.
23
36
24
- Pods are only [ scheduled] ( /docs/concepts/scheduling-eviction/ ) once in their lifetime.
25
- Once a Pod is scheduled (assigned) to a Node, the Pod runs on that Node until it stops
26
- or is [ terminated] ( #pod-termination ) .
37
+ Pods are only [ scheduled] ( /docs/concepts/scheduling-eviction/ ) once in their lifetime;
38
+ assigning a Pod to a specific node is called _ binding_ , and the process of selecting
39
+ which node to use is called _ scheduling_ .
40
+ Once a Pod has been scheduled and is bound to a node, Kubernetes tries
41
+ to run that Pod on the node. The Pod runs on that node until it stops, or until the Pod
42
+ is [ terminated] ( #pod-termination ) ; if Kubernetes isn't able start the Pod on the selected
43
+ node (for example, if the node crashes before the Pod starts), then that particular Pod
44
+ never starts.
27
45
28
- <!-- body -->
46
+ You can use [ Pod Scheduling Readiness] ( /docs/concepts/scheduling-eviction/pod-scheduling-readiness/ )
47
+ to delay scheduling for a Pod until all its _ scheduling gates_ are removed. For example,
48
+ you might want to define a set of Pods but only trigger scheduling once all the Pods
49
+ have been created.
29
50
30
- ## Pod lifetime
51
+ ### Pods and fault recovery {#pod-fault-recovery}
31
52
32
- Like individual application containers, Pods are considered to be relatively
33
- ephemeral (rather than durable) entities. Pods are created, assigned a unique
34
- ID ([ UID] ( /docs/concepts/overview/working-with-objects/names/#uids ) ), and scheduled
35
- to nodes where they remain until termination (according to restart policy) or
36
- deletion.
37
- If a {{< glossary_tooltip term_id="node" >}} dies, the Pods scheduled to that node
38
- are [ scheduled for deletion] ( #pod-garbage-collection ) after a timeout period.
53
+ If one of the containers in the Pod fails, then Kubernetes may try to restart that
54
+ specific container.
55
+ Read [ How Pods handle problems with containers] ( #container-restarts ) to learn more.
39
56
40
- Pods do not, by themselves, self-heal. If a Pod is scheduled to a
41
- {{< glossary_tooltip text="node" term_id="node" >}} that then fails, the Pod is deleted; likewise,
42
- a Pod won't survive an eviction due to a lack of resources or Node maintenance. Kubernetes uses a
43
- higher-level abstraction, called a
57
+ Pods can however fail in a way that the cluster cannot recover from, and in that case
58
+ Kubernetes does not attempt to heal the Pod further; instead, Kubernetes deletes the
59
+ Pod and relies on other components to provide automatic healing.
60
+
61
+ If a Pod is scheduled to a {{< glossary_tooltip text="node" term_id="node" >}} and that
62
+ node then fails, the Pod is treated as unhealthy and Kubernetes eventually deletes the Pod.
63
+ A Pod won't survive an {{< glossary_tooltip text="eviction" term_id="eviction" >}} due to
64
+ a lack of resources or Node maintenance.
65
+
66
+ Kubernetes uses a higher-level abstraction, called a
44
67
{{< glossary_tooltip term_id="controller" text="controller" >}}, that handles the work of
45
68
managing the relatively disposable Pod instances.
46
69
47
70
A given Pod (as defined by a UID) is never "rescheduled" to a different node; instead,
48
- that Pod can be replaced by a new, near-identical Pod, with even the same name if
49
- desired, but with a different UID.
71
+ that Pod can be replaced by a new, near-identical Pod. If you make a replacement Pod, it can
72
+ even have same name (as in ` .metadata.name ` ) that the old Pod had, but the replacement
73
+ would have a different ` .metadata.uid ` from the old Pod.
74
+
75
+ Kubernetes does not guarantee that a replacement for an existing Pod would be scheduled to
76
+ the same node as the old Pod that was being replaced.
77
+
78
+ ### Associated lifetimes
50
79
51
80
When something is said to have the same lifetime as a Pod, such as a
52
81
{{< glossary_tooltip term_id="volume" text="volume" >}},
@@ -55,10 +84,7 @@ exists. If that Pod is deleted for any reason, and even if an identical replacem
55
84
is created, the related thing (a volume, in this example) is also destroyed and
56
85
created anew.
57
86
58
- {{< figure src="/images/docs/pod.svg" title="Pod diagram" class="diagram-medium" >}}
59
-
60
- A multi-container Pod that contains a file puller and a
61
- web server that uses a persistent volume for shared storage between the containers.
87
+ {{< figure src="/images/docs/pod.svg" title="Figure 1." class="diagram-medium" caption="A multi-container Pod that contains a file puller [ sidecar] ( /docs/concepts/workloads/pods/sidecar-containers/ ) and a web server. The Pod uses an [ ephemeral ` emptyDir ` volume] ( /docs/concepts/storage/volumes/#emptydir ) for shared storage between the containers." >}}
62
88
63
89
## Pod phase
64
90
@@ -348,13 +374,6 @@ after successful sandbox creation and network configuration by the runtime
348
374
plugin). For a Pod without init containers, the kubelet sets the ` Initialized `
349
375
condition to ` True ` before sandbox creation and network configuration starts.
350
376
351
- ### Pod scheduling readiness {#pod-scheduling-readiness-gate}
352
-
353
- {{< feature-state for_k8s_version="v1.26" state="alpha" >}}
354
-
355
- See [ Pod Scheduling Readiness] ( /docs/concepts/scheduling-eviction/pod-scheduling-readiness/ )
356
- for more information.
357
-
358
377
## Container probes
359
378
360
379
A _ probe_ is a diagnostic performed periodically by the [ kubelet] ( /docs/reference/command-line-tools-reference/kubelet/ )
0 commit comments