Skip to content

Commit 2a10ec4

Browse files
authored
Merge pull request #27988 from verb/1.22-api
Update website for change in the 1.22 ephemeral containers API
2 parents 3473888 + ede985d commit 2a10ec4

File tree

2 files changed

+9
-122
lines changed

2 files changed

+9
-122
lines changed

content/en/docs/concepts/workloads/pods/ephemeral-containers.md

Lines changed: 4 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ weight: 80
99

1010
<!-- overview -->
1111

12-
{{< feature-state state="alpha" for_k8s_version="v1.16" >}}
12+
{{< feature-state state="alpha" for_k8s_version="v1.22" >}}
1313

1414
This page provides an overview of ephemeral containers: a special type of container
1515
that runs temporarily in an existing {{< glossary_tooltip term_id="pod" >}} to
1616
accomplish user-initiated actions such as troubleshooting. You use ephemeral
1717
containers to inspect services rather than to build applications.
1818

1919
{{< warning >}}
20-
Ephemeral containers are in early alpha state and are not suitable for production
20+
Ephemeral containers are in alpha state and are not suitable for production
2121
clusters. In accordance with the [Kubernetes Deprecation Policy](
2222
/docs/reference/using-api/deprecation-policy/), this alpha feature could change
2323
significantly in the future or be removed entirely.
@@ -77,119 +77,7 @@ When using ephemeral containers, it's helpful to enable [process namespace
7777
sharing](/docs/tasks/configure-pod-container/share-process-namespace/) so
7878
you can view processes in other containers.
7979

80-
See [Debugging with Ephemeral Debug Container](
81-
/docs/tasks/debug-application-cluster/debug-running-pod/#ephemeral-container)
82-
for examples of troubleshooting using ephemeral containers.
83-
84-
## Ephemeral containers API
85-
86-
{{< note >}}
87-
The examples in this section require the `EphemeralContainers` [feature
88-
gate](/docs/reference/command-line-tools-reference/feature-gates/) to be
89-
enabled, and Kubernetes client and server version v1.16 or later.
90-
{{< /note >}}
91-
92-
The examples in this section demonstrate how ephemeral containers appear in
93-
the API. You would normally use `kubectl debug` or another `kubectl`
94-
[plugin](/docs/tasks/extend-kubectl/kubectl-plugins/) to automate these steps
95-
rather than invoking the API directly.
96-
97-
Ephemeral containers are created using the `ephemeralcontainers` subresource
98-
of Pod, which can be demonstrated using `kubectl --raw`. First describe
99-
the ephemeral container to add as an `EphemeralContainers` list:
100-
101-
```json
102-
{
103-
"apiVersion": "v1",
104-
"kind": "EphemeralContainers",
105-
"metadata": {
106-
"name": "example-pod"
107-
},
108-
"ephemeralContainers": [{
109-
"command": [
110-
"sh"
111-
],
112-
"image": "busybox",
113-
"imagePullPolicy": "IfNotPresent",
114-
"name": "debugger",
115-
"stdin": true,
116-
"tty": true,
117-
"terminationMessagePolicy": "File"
118-
}]
119-
}
120-
```
121-
122-
To update the ephemeral containers of the already running `example-pod`:
123-
124-
```shell
125-
kubectl replace --raw /api/v1/namespaces/default/pods/example-pod/ephemeralcontainers -f ec.json
126-
```
127-
128-
This will return the new list of ephemeral containers:
129-
130-
```json
131-
{
132-
"kind":"EphemeralContainers",
133-
"apiVersion":"v1",
134-
"metadata":{
135-
"name":"example-pod",
136-
"namespace":"default",
137-
"selfLink":"/api/v1/namespaces/default/pods/example-pod/ephemeralcontainers",
138-
"uid":"a14a6d9b-62f2-4119-9d8e-e2ed6bc3a47c",
139-
"resourceVersion":"15886",
140-
"creationTimestamp":"2019-08-29T06:41:42Z"
141-
},
142-
"ephemeralContainers":[
143-
{
144-
"name":"debugger",
145-
"image":"busybox",
146-
"command":[
147-
"sh"
148-
],
149-
"resources":{
150-
151-
},
152-
"terminationMessagePolicy":"File",
153-
"imagePullPolicy":"IfNotPresent",
154-
"stdin":true,
155-
"tty":true
156-
}
157-
]
158-
}
159-
```
160-
161-
You can view the state of the newly created ephemeral container using `kubectl describe`:
162-
163-
```shell
164-
kubectl describe pod example-pod
165-
```
166-
167-
```
168-
...
169-
Ephemeral Containers:
170-
debugger:
171-
Container ID: docker://cf81908f149e7e9213d3c3644eda55c72efaff67652a2685c1146f0ce151e80f
172-
Image: busybox
173-
Image ID: docker-pullable://busybox@sha256:9f1003c480699be56815db0f8146ad2e22efea85129b5b5983d0e0fb52d9ab70
174-
Port: <none>
175-
Host Port: <none>
176-
Command:
177-
sh
178-
State: Running
179-
Started: Thu, 29 Aug 2019 06:42:21 +0000
180-
Ready: False
181-
Restart Count: 0
182-
Environment: <none>
183-
Mounts: <none>
184-
...
185-
```
186-
187-
You can interact with the new ephemeral container in the same way as other
188-
containers using `kubectl attach`, `kubectl exec`, and `kubectl logs`, for
189-
example:
190-
191-
```shell
192-
kubectl attach -it example-pod -c debugger
193-
```
80+
## {{% heading "whatsnext" %}}
19481

82+
* Learn how to [debug pods using ephemeral containers](/docs/tasks/debug-application-cluster/debug-running-pod/#ephemeral-container).
19583

content/en/docs/tasks/debug-application-cluster/debug-running-pod.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,20 @@ For more details, see [Get a Shell to a Running Container](
7373

7474
## Debugging with an ephemeral debug container {#ephemeral-container}
7575

76-
{{< feature-state state="alpha" for_k8s_version="v1.18" >}}
76+
{{< feature-state state="alpha" for_k8s_version="v1.22" >}}
7777

7878
{{< glossary_tooltip text="Ephemeral containers" term_id="ephemeral-container" >}}
7979
are useful for interactive troubleshooting when `kubectl exec` is insufficient
8080
because a container has crashed or a container image doesn't include debugging
8181
utilities, such as with [distroless images](
82-
https://github.com/GoogleContainerTools/distroless). `kubectl` has an alpha
83-
command that can create ephemeral containers for debugging beginning with version
84-
`v1.18`.
82+
https://github.com/GoogleContainerTools/distroless).
8583

8684
### Example debugging using ephemeral containers {#ephemeral-container-example}
8785

8886
{{< note >}}
8987
The examples in this section require the `EphemeralContainers` [feature gate](
9088
/docs/reference/command-line-tools-reference/feature-gates/) enabled in your
91-
cluster and `kubectl` version v1.18 or later.
89+
cluster and `kubectl` version v1.22 or later.
9290
{{< /note >}}
9391

9492
You can use the `kubectl debug` command to add ephemeral containers to a
@@ -137,7 +135,8 @@ creates.
137135
The `--target` parameter must be supported by the {{< glossary_tooltip
138136
text="Container Runtime" term_id="container-runtime" >}}. When not supported,
139137
the Ephemeral Container may not be started, or it may be started with an
140-
isolated process namespace.
138+
isolated process namespace so that `ps` does not reveal processes in other
139+
containers.
141140
{{< /note >}}
142141

143142
You can view the state of the newly created ephemeral container using `kubectl describe`:

0 commit comments

Comments
 (0)