@@ -9,15 +9,15 @@ weight: 80
9
9
10
10
<!-- overview -->
11
11
12
- {{< feature-state state="alpha" for_k8s_version="v1.16 " >}}
12
+ {{< feature-state state="alpha" for_k8s_version="v1.22 " >}}
13
13
14
14
This page provides an overview of ephemeral containers: a special type of container
15
15
that runs temporarily in an existing {{< glossary_tooltip term_id="pod" >}} to
16
16
accomplish user-initiated actions such as troubleshooting. You use ephemeral
17
17
containers to inspect services rather than to build applications.
18
18
19
19
{{< 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
21
21
clusters. In accordance with the [ Kubernetes Deprecation Policy] (
22
22
/docs/reference/using-api/deprecation-policy/), this alpha feature could change
23
23
significantly in the future or be removed entirely.
@@ -77,119 +77,7 @@ When using ephemeral containers, it's helpful to enable [process namespace
77
77
sharing] ( /docs/tasks/configure-pod-container/share-process-namespace/ ) so
78
78
you can view processes in other containers.
79
79
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" %}}
194
81
82
+ * Learn how to [ debug pods using ephemeral containers] ( /docs/tasks/debug-application-cluster/debug-running-pod/#ephemeral-container ) .
195
83
0 commit comments