@@ -186,16 +186,22 @@ 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 the object and write it back to the pod's ` /ephemeralcontainers `
197
+ subresource, for example using ` UpdateEphemeralContainers ` in the generated
198
+ client. (Patching is also supported on ` /ephemeralcontainers ` .)
199
+ 1 . The apiserver validates the update.
195
200
1 . Pod validation fails if container spec contains fields disallowed for
196
201
Ephemeral Containers or the same name as a container in the spec or
197
202
` EphemeralContainers ` .
198
- 1 . API resource versioning resolves update races.
203
+ 1 . Registered admission controllers receive an ` AdmissionReview ` request
204
+ containing the entire ` Pod ` .
199
205
1 . The kubelet's pod watcher notices the update and triggers a ` syncPod() ` .
200
206
During the sync, the kubelet calls ` kuberuntime.StartEphemeralContainer() `
201
207
for any new Ephemeral Container.
@@ -303,7 +309,7 @@ ephemeral container creation in a cluster.
303
309
304
310
Ephemeral Containers will stop when their command exits, such as exiting a
305
311
shell, and they will not be restarted. Unlike ` kubectl exec ` , processes in
306
- Ephemeral Containers will not receive an EOF if their connection is
312
+ Ephemeral Containers will not receive an EOF if their connections are
307
313
interrupted, so shells won't automatically exit on disconnect. Without the
308
314
ability to remove an Ephemeral Container via the API, the only way to exit the
309
315
container is to send it an OS signal.
@@ -629,10 +635,7 @@ via this subresource. `EphemeralContainerStatuses` is updated in the same manner
629
635
as everything else in ` Pod.Status ` via ` /status ` .
630
636
631
637
` 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.
638
+ normal (using PUT, PATCH, etc).
636
639
637
640
The subresources ` attach ` , ` exec ` , ` log ` , and ` portforward ` are available for
638
641
Ephemeral Containers and will be forwarded by the apiserver. This means `kubectl
@@ -1039,6 +1042,7 @@ _This section must be completed when targeting beta graduation to a release._
1039
1042
- * 2019-04-24* : Added notes on Windows feature compatibility
1040
1043
- * 2020-09-29* : Ported KEP to directory-based template.
1041
1044
- * 2021-01-07* : Updated KEP for beta release in 1.21 and completed PRR section.
1045
+ - * 2021-04-12* : Switched ` /ephemeralcontainers ` API to use ` Pod ` .
1042
1046
1043
1047
## Drawbacks
1044
1048
0 commit comments