You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/pod-sandbox-lifecycle.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
This specification defines how NRI plugins interact with pod sandbox lifecycle events. The underlying pod sandbox operations are defined by the [Kubernetes CRI API](https://github.com/kubernetes/cri-api):
6
6
7
7
-**RunPodSandbox (CRI)**: Creates and starts a pod-level sandbox. Runtimes must ensure the sandbox is in the ready state on success.
8
-
-**StopPodSandbox (CRI)**: Stops any running process that is part of the sandbox and reclaims network resources.
8
+
-**StopPodSandbox (CRI)**: Stops any running process that is part of the sandbox and directs the runtime to reclaim certain pod resources (e.g. Network Namespace, CNI teardown, and image mounts). May be called multiple times, and is idempotent.
9
9
-**RemovePodSandbox (CRI)**: Removes the sandbox. If there are any running containers, they must be forcibly terminated and removed.
10
10
11
11
This NRI specification details when and under what conditions NRI plugins receive notifications for these events, ensuring plugins can reliably depend on consistent sandbox state across different runtime implementations.
@@ -14,7 +14,7 @@ This NRI specification details when and under what conditions NRI plugins receiv
14
14
15
15
The pod sandbox lifecycle consists of three distinct phases, each with a corresponding NRI event that plugins can subscribe to:
16
16
17
-
1.**RunPodSandbox**: Fired after the runtime successfully executes CRI RunPodSandbox
17
+
1.**RunPodSandbox**: Fired during the the runtime CRI RunPodSandbox execution, after the PodSandbox is created but before setting the pod to running and then replying success to CRI RunPodSandbox request.
18
18
2.**StopPodSandbox**: Fired when the runtime initiates CRI StopPodSandbox
19
19
3.**RemovePodSandbox**: Fired when the runtime performs CRI RemovePodSandbox
20
20
@@ -27,7 +27,7 @@ For each event, this specification defines:
27
27
28
28
**CRI Operation**: RunPodSandbox - Creates and starts a pod-level sandbox.
29
29
30
-
**NRI Event Timing**: The RunPodSandbox NRI event is fired after the runtime has successfully executed the CRI RunPodSandbox operation and the sandbox has reached a "Ready" state, but before any workload containers are started.
30
+
**NRI Event Timing**: The RunPodSandbox NRI event is fired after the runtime has successfully executed most of the CRI RunPodSandbox operation; NRI plugin execution is the final step before the sandbox reaches a "Ready" state. The Kubelet does not start workload containers until after the sandbox becomes "Ready".
31
31
32
32
### Sandbox State Contract
33
33
@@ -38,7 +38,7 @@ When the runtime fires the RunPodSandbox NRI event, it guarantees:
38
38
- Network setup has been fully configured (network interfaces are up and assigned addressing)
39
39
- The pod IP address (if applicable) is assigned and available
40
40
- The "pause" container (if the runtime uses one) is running
41
-
- All prerequisite operations for workload container startup are complete
41
+
- All prerequisite operations for workload container startup are complete, the pod is in the "unknown state" and will become "Ready" once the NRI event is processed. This guarantees the NRI plugin has a window to allocate resources for the pod before any workload containers are started.
42
42
43
43
### Plugin Responsibilities and Capabilities
44
44
@@ -64,7 +64,7 @@ When the runtime fires the StopPodSandbox NRI event, it guarantees:
64
64
65
65
- Workload containers within the sandbox are stopped or are stopping
66
66
-**CRITICAL**: The sandbox infrastructure still exists and remains fully accessible during this hook
67
-
- The network namespace is not unmounted or deleted until this hook completes
67
+
- The pod resources allocated by the runtime; such as network namespace, CNI networks, and image mounts; are not unmounted or deleted until this hook completes
68
68
- The pod's cgroups remain accessible
69
69
- All pod-level resources remain stable until this hook returns
70
70
@@ -84,7 +84,7 @@ StopPodSandbox is the designated cleanup and observation phase for plugins. Upon
84
84
85
85
**CRI Operation**: RemovePodSandbox - Removes the sandbox and forcibly terminates any remaining containers.
86
86
87
-
**NRI Event Timing**: The RemovePodSandbox NRI event is fired when the runtime initiates the CRI RemovePodSandbox operation, during final garbage collection.
87
+
**NRI Event Timing**: The RemovePodSandbox NRI event is fired when the runtime initiates the CRI RemovePodSandbox operation, just prior to removing the pod from the pod list.
88
88
89
89
### Sandbox State Contract
90
90
@@ -114,8 +114,8 @@ Plugins receiving this event should only:
114
114
115
115
Runtimes MUST guarantee the following ordering:
116
116
117
-
1.**RunPodSandbox** NRI event fires after successful CRI RunPodSandbox execution
118
-
2.**StopPodSandbox** NRI event fires during CRI StopPodSandbox execution
117
+
1.**RunPodSandbox** NRI event fires after successful CRI RunPodSandbox execution, but before the pod is set to the "Ready" state.
118
+
2.**StopPodSandbox** NRI event fires during CRI StopPodSandbox execution, just prior to removing the runtime pod resources allocated by the runtime; such as network namespace, CNI networks, and image mounts
119
119
3.**RemovePodSandbox** NRI event fires during CRI RemovePodSandbox execution
120
120
4. These events MUST fire in strict order: RunPodSandbox → StopPodSandbox → RemovePodSandbox
121
121
5. No workload containers will be started until after RunPodSandbox hook completes
0 commit comments