Run a test Docker container¶
To override the entrypoint, use:
The above assumes you are using cygwin / git bash on Windows.
Run a test K8s pod¶
Useful options:
-
--restart=Never -
if the pod has a console:
-i --tty --command -- bash -
Attach to the (first) container in the Pod:
If there are multiple containers in the pod, use: -c <container name>
- Get a shell to a running Container:
- Delete test pod:
Ephemeral Debug Containers¶
Starting with Kubernetes 1.25, kubectl debug allows you to attach an ephemeral container to a running pod for troubleshooting, which is especially useful if the pod's image doesn't contain debugging utilities (like bash or curl).
# Add an interactive busybox container to a running pod
kubectl debug -it <pod_name> --image=busybox --target=<container_name>
# Debug a node by creating a privileged pod on it
kubectl debug node/<node_name> -it --image=ubuntu