@@ -186,16 +186,24 @@ restrictions:
186
186
187
187
### Creating Ephemeral Containers
188
188
189
- 1 . A client fetches the current list of Ephemeral Containers in a pod using
190
- ` GetEphemeralContainers ` in the generated client. This returns a
191
- ` v1.EphemeralContainers ` to which the client appends a new
192
- ` EphemeralContainer ` and then calls ` UpdateEphemeralContainers ` .
193
- 1 . The apiserver validates and performs the pod update, copying the new
194
- ephemeral container into ` Pod.Spec.EphemeralContainers ` .
189
+ Ephemeral containers are described in the ` EphemeralContainers ` field of
190
+ ` Pod.Spec ` . This must be updated using the ` /ephemeralcontainers ` subresource,
191
+ similarly to updating ` Pod.Status ` via ` /status ` .
192
+
193
+ The end-to-end process for creating an ephemeral container is:
194
+
195
+ 1 . Fetch a ` Pod ` object from the ` /pods ` resource.
196
+ 1 . Modify ` spec.ephemeralContainers ` and write it back to the Pod's
197
+ ` /ephemeralcontainers ` subresource, for example using ` UpdateEphemeralContainers `
198
+ in the generated client. (Patching is also supported on ` /ephemeralcontainers ` .)
199
+ 1 . The apiserver discards all changes except those to ` spec.ephemeralContainers ` .
200
+ That is, only ` spec.ephemeralContainers ` may be changed via ` /ephemeralcontainers ` .
201
+ 1 . The apiserver validates the update.
195
202
1 . Pod validation fails if container spec contains fields disallowed for
196
203
Ephemeral Containers or the same name as a container in the spec or
197
204
` EphemeralContainers ` .
198
- 1 . API resource versioning resolves update races.
205
+ 1 . Registered admission controllers receive an ` AdmissionReview ` request
206
+ containing the entire ` Pod ` .
199
207
1 . The kubelet's pod watcher notices the update and triggers a ` syncPod() ` .
200
208
During the sync, the kubelet calls ` kuberuntime.StartEphemeralContainer() `
201
209
for any new Ephemeral Container.
@@ -303,7 +311,7 @@ ephemeral container creation in a cluster.
303
311
304
312
Ephemeral Containers will stop when their command exits, such as exiting a
305
313
shell, and they will not be restarted. Unlike ` kubectl exec ` , processes in
306
- Ephemeral Containers will not receive an EOF if their connection is
314
+ Ephemeral Containers will not receive an EOF if their connections are
307
315
interrupted, so shells won't automatically exit on disconnect. Without the
308
316
ability to remove an Ephemeral Container via the API, the only way to exit the
309
317
container is to send it an OS signal.
@@ -629,10 +637,8 @@ via this subresource. `EphemeralContainerStatuses` is updated in the same manner
629
637
as everything else in ` Pod.Status ` via ` /status ` .
630
638
631
639
` Pod.Spec.EphemeralContainers ` may be updated via ` /ephemeralcontainers ` as per
632
- normal (using PUT, PATCH, etc) except that existing Ephemeral Containers may not
633
- be modified or deleted. Deleting Ephemeral Containers is not supported in the
634
- initial implementation to reduce complexity. It could be added in the future,
635
- but see * Killing Ephemeral Containers* below for additional constraints.
640
+ normal (using PUT, PATCH, etc) except that existing Ephemeral Containers may
641
+ not be modified.
636
642
637
643
The subresources ` attach ` , ` exec ` , ` log ` , and ` portforward ` are available for
638
644
Ephemeral Containers and will be forwarded by the apiserver. This means `kubectl
@@ -1039,6 +1045,7 @@ _This section must be completed when targeting beta graduation to a release._
1039
1045
- * 2019-04-24* : Added notes on Windows feature compatibility
1040
1046
- * 2020-09-29* : Ported KEP to directory-based template.
1041
1047
- * 2021-01-07* : Updated KEP for beta release in 1.21 and completed PRR section.
1048
+ - * 2021-04-12* : Switched ` /ephemeralcontainers ` API to use ` Pod ` .
1042
1049
1043
1050
## Drawbacks
1044
1051
0 commit comments