Creates a pod from a specified container image and command options. Use interactive mode to create a temporary troubleshooting environment inside the pod’s network namespace. section 8.1.2
Open a troubleshooting shell
Run `kubectl run tool --image lansible/dnstools:latest -it`, then test cluster communication with commands such as `nslookup kubernetes`, `curl`, or `cat /etc/resolv.conf`. After exiting, reconnect with `kubectl exec -it tool -- sh`. Add `--rm` to delete the pod when the session ends: `kubectl run curlpod --image=nicolaka/netshoot --rm -it -- sh`. section 8.1.2
Use kubectl run during pod troubleshooting to:
- Create a shell-capable pod when the failing container cannot be opened. section 8.1.2
- Generate a pod manifest for later editing with `--dry-run=client -o yaml`. section 8.1.1
root@kind-control-plane:/# kubectl run tool --image lansible/dnstools:latest -it If you don't see a command prompt, try pressing enter. / #
Shows the interactive prompt produced when kubectl run creates a troubleshooting pod. section 8.1.2
