Skip to content

Commit 1f77e8f

Browse files
committed
KEP-277: clarify removing ephemeral containers
We've decided to spin this feature into a future KEP so that KEP-277 may proceed to beta .
1 parent 4d2b1c9 commit 1f77e8f

File tree

1 file changed

+23
-65
lines changed
  • keps/sig-node/277-ephemeral-containers

1 file changed

+23
-65
lines changed

keps/sig-node/277-ephemeral-containers/README.md

Lines changed: 23 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010
- [Non-Goals](#non-goals)
1111
- [Proposal](#proposal)
1212
- [Creating Ephemeral Containers](#creating-ephemeral-containers)
13-
- [Identifying Pods with Ephemeral Containers](#identifying-pods-with-ephemeral-containers)
14-
- [Reattaching and Restarting Ephemeral Containers](#reattaching-and-restarting-ephemeral-containers)
13+
- [Reattaching Ephemeral Containers](#reattaching-ephemeral-containers)
14+
- [Ephemeral Container Lifecycle](#ephemeral-container-lifecycle)
15+
- [Removing Ephemeral Containers](#removing-ephemeral-containers)
1516
- [Configurable Security Policy](#configurable-security-policy)
1617
- [Specifying Security Context](#specifying-security-context)
1718
- [Compatibility with existing Admission Controllers](#compatibility-with-existing-admission-controllers)
18-
- [Killing Ephemeral Containers](#killing-ephemeral-containers)
19-
- [Removing and Re-adding Ephemeral Containers](#removing-and-re-adding-ephemeral-containers)
2019
- [User Stories](#user-stories)
2120
- [Operations](#operations)
2221
- [Debugging](#debugging)
@@ -221,28 +220,31 @@ There are no limits on the number of Ephemeral Containers that can be created in
221220
a pod, but exceeding a pod's resource allocation may cause the pod to be
222221
evicted.
223222

224-
### Identifying Pods with Ephemeral Containers
223+
### Reattaching Ephemeral Containers
225224

226-
The kubelet will set a `PodCondition` when it starts an Ephemeral Container.
227-
This condition may not be cleared: it will exist for the lifetime of the Pod
228-
and continues to exist even if all Ephemeral Containers are removed.
225+
One may reattach to a Ephemeral Container using `kubectl attach`. When supported
226+
by a runtime, multiple clients can attach to a single debug container and share
227+
the terminal. This is supported by the Docker runtime.
229228

230-
The intended use of this `PodCondition` is to enable administrators to enforce
231-
custom policies for pods that have had Ephemeral Containers. For example,
232-
cluster administrators may want to automatically apply a label or delete the pod
233-
after a configurable time. This may be accomplished by a controller watching
234-
for this `PodCondition`, though the implementation of such a controller is out
235-
of scope for this proposal.
229+
### Ephemeral Container Lifecycle
236230

237-
### Reattaching and Restarting Ephemeral Containers
231+
Ephemeral containers will stop when their command exits, such as exiting a
232+
shell, and they will not be restarted. Unlike `kubectl exec`, processes in
233+
Ephemeral Containers will not receive an EOF if their connections are
234+
interrupted, so shells won't automatically exit on disconnect.
238235

239-
One can reattach to a Ephemeral Container using `kubectl attach`. When supported
240-
by a runtime, multiple clients can attach to a single debug container and share
241-
the terminal. This is supported by Docker.
236+
There is no API support for killing or restarting an ephemeral container.
237+
The only way to exit the container is to send it an OS signal.
238+
239+
### Removing Ephemeral Containers
242240

243-
Ephemeral Containers will not be restarted automatically, and there is no
244-
method in the API to restart an Ephemeral Container. Creators of Ephemeral
245-
Containers are expected to choose a new, unused name.
241+
Ephemeral containers may not be removed from a Pod once added, but
242+
we've received feedback during the alpha period that users would like
243+
the possibility of removing ephemeral containers (see
244+
[#84764](https://issues.k8s.io/84764)).
245+
246+
Removal is out of scope for the initial graduation of ephemeral containers,
247+
but it may be added by a future KEP.
246248

247249
### Configurable Security Policy
248250

@@ -307,50 +309,6 @@ administrators should ensure that their admission controllers support ephemeral
307309
containers prior to upgrading and provide instructions for how to disable
308310
ephemeral container creation in a cluster.
309311

310-
### Killing Ephemeral Containers
311-
312-
Ephemeral Containers will stop when their command exits, such as exiting a
313-
shell, and they will not be restarted. Unlike `kubectl exec`, processes in
314-
Ephemeral Containers will not receive an EOF if their connections are
315-
interrupted, so shells won't automatically exit on disconnect. Without the
316-
ability to remove an Ephemeral Container via the API, the only way to exit the
317-
container is to send it an OS signal.
318-
319-
Killing an Ephemeral Container is supported by removing it from the list of
320-
Ephemeral Containers in the Pod spec. The kubelet will then kill the container
321-
and cease publishing a `ContainerStatus` for this container.
322-
323-
#### Removing and Re-adding Ephemeral Containers
324-
325-
An edge case worth considering is what happens when a user removes and re-adds
326-
a Ephemeral Container with the same name. This presents a synchronization
327-
problem not present in the immutable container lists, which we resolve by
328-
enforcing the following constraints:
329-
330-
- The client MUST NOT add an Ephemeral Container with the same name as
331-
a container listed in `Pod.Status.EphemeralContainerStatuses`. This is an
332-
error and will be rejected by the API server.
333-
- The kubelet MAY continue publishing an `EphemeralContainerStatus` for
334-
an Ephemeral Container that no longer appears in
335-
`Pod.Spec.EphemeralContainers`.
336-
- The kubelet MUST start a new container for any container in
337-
`Pod.Spec.EphemeralContainers` that does not also appear in
338-
`Pod.Status.EphemeralContainerStatuses.
339-
340-
In this way the kubelet is able to signal to clients the set of container names
341-
which are unavailable because they correspond to containers still running on
342-
the node. The procedure for replacing a container then becomes:
343-
344-
1. A client removes an Ephemeral Container from `Pod.Spec.EphemeralContainers`.
345-
2. The client waits for the Ephemeral Container to be removed from
346-
`Pod.Status.EphemeralContainerStatuses`.
347-
3. The client adds an Ephemeral Container with the same name to
348-
`Pod.Spec.EphemeralContainers`.
349-
350-
This is not recommended, however, because the kubelet is under no obligation to
351-
remove the Ephemeral Container from `EphemeralContainerStatuses` in a timely
352-
fashion. Clients should choose a new container name instead.
353-
354312
### User Stories
355313

356314
#### Operations

0 commit comments

Comments
 (0)