@@ -233,35 +233,44 @@ Options:
233
233
```
234
234
235
235
The modification ` kubectl debug ` makes to ` Pod.Spec.Containers ` depends on the
236
- value of the ` --container ` flag.
236
+ value of the ` --container ` flag. Unlike with debugging with ephemeral
237
+ containers, debugging by copy does not support generating a name for new
238
+ containers.
237
239
238
240
#### Creating a Debug Container by copy
239
241
240
- If a user does not specify a ` --container ` or specifies one that does not exist,
242
+ If a user specifies a container name with ` --container ` that does not exist,
241
243
then the user is instructing ` kubectl debug ` to create a new Debug Container in
242
- the Pod copy.
244
+ the Pod copy. In this case ` --image ` is the container image to use for the new
245
+ container.
243
246
244
247
```
245
248
Examples:
246
249
# Create a debug container as a copy of the original Pod and attach to it
247
- kubectl debug mypod -it --image=busybox --copy-to=my-debugger
250
+ kubectl debug mypod -it -container=debug - -image=busybox --copy-to=my-debugger
248
251
```
249
252
250
253
#### Modify Application Image by Copy
251
254
252
- If a user specifies a ` --container ` , then they are instructing ` kubectl debug ` to
253
- create a copy of the target pod with a new image for one of the containers.
255
+ If a user specifies a container name with ` --container ` that exists, then the
256
+ user is instructing ` kubectl debug ` to change the image for this one container
257
+ to the image specified in ` --image ` .
258
+
259
+ If a user does not specify a ` --container ` , then they are instructing `kubectl
260
+ debug` to change the image for one or more containers in the pod. In this case,
261
+ ` --image ` is the image mutation language defined by ` kubectl set image ` .
254
262
255
263
```
256
264
Examples:
257
265
# Create a copy of mypod named my-debugger with my-container's image changed to busybox
258
266
kubectl debug mypod --image=busybox --container=my-container --copy-to=my-debugger -- sleep 1d
259
- ```
260
267
261
- Note that the Pod API allows updates of container images in-place, so
262
- ` --copy-to ` is not necessary for this operation. ` kubectl debug ` isn't necessary
263
- to achieve this -- it can be done today with patch -- but ` kubectl debug ` could
264
- implement it as well for completeness.
268
+ # Create a copy of mypod with the image of all container changed to busybox
269
+ kubectl debug mypod --image=*=busybox --copy-to=my-debugger
270
+
271
+ # Create a copy of mypod with the specified image changes
272
+ kubectl debug mypod --image=main=busybox,sidecar=debian --copy-to=my-debugger
273
+ ```
265
274
266
275
### Node Troubleshooting with Privileged Containers
267
276
@@ -734,6 +743,8 @@ _This section must be completed when targeting beta graduation to a release._
734
743
- * 2020-01-09* : Updated KEP for debugging nodes and mark implementable.
735
744
- * 2020-01-15* : Added test plan.
736
745
- * 2020-09-20* : Updated to reflect actual implementation details.
746
+ - * 2020-09-23* : Add support for mutating multiple container images in
747
+ debug-by-copy.
737
748
738
749
## Drawbacks
739
750
0 commit comments