kubectl debug
Debug cluster resources using interactive debugging containers. More information: https://kubernetes.io/docs/reference/kubectl/generated/kubectl_debug/.
- Create an interactive debugging session in a pod and immediately attach to it:
kubectl debug --image busybox
- Create a debug container with a custom image and name:
kubectl debug --image
- Create an interactive debugging session on a node and immediately attach to it (the container will run in the host namespaces and the host's filesystem will be mounted at
/host):
kubectl debug node/ --image busybox
- Create a copy of a pod and add a debug container to it:
kubectl debug --image --copy-to
- Create a copy of a pod and change the command of a specific container:
kubectl debug --copy-to --container --
- Create a copy of a pod and change the image of a specific container:
kubectl debug --copy-to --set-image =
- Create a copy of a pod and change all container images:
kubectl debug --copy-to --set-image '*='
- Create an ephemeral debug container and target a specific container (useful for debugging distroless containers):
kubectl debug --image --target
来源:tldr-pages contributors · 作者与贡献记录 · CC BY 4.0。离线整理了版式、链接和媒体显示。
