| Pod 内调试 | kubectl debug -it <pod> --image=nicolaka/netshoot --target=<容器> |
|---|---|
| 复制重建 | kubectl debug <pod> --copy-to=debug-pod --image=busybox 改配置复现 |
| 节点级 | kubectl debug node/<node> -it --image=busybox,宿主根挂在 /host |
| 关键参数 | --target 让临时容器共享目标容器的进程命名空间 |
| 限制 | ephemeral 容器不能配端口与资源,仅用于调试 |
调试命令
调试命令
kubectl debug -it web-1 --image=nicolaka/netshoot --target=web
# 节点级:对比宿主环境与内核
kubectl debug node/node-1 -it --image=busybox
ps aux
cat /host/etc/os-release容器没 shell 时优先加临时调试容器,而不是重建业务 Pod;只有要复现带配置变更的启动问题时才用 --copy-to。