A plugin for kubectl that allows you to SSH to a pod.
Put the files from the bin
directory somewhere in your $PATH
and make sure
they're executable.
# Connect to a pod in the current namespace.
kubectl ssh POD
# Connect to an arbitrary pod in the named deployment.
kubectl -n NAMESPACE ssh deployment/DEPLOYMENT
Tab completion for kubectl ssh
works, provided you've got kubectl
newer than
v1.26.0
, and that tab completion for kubectl
works for other commands.
The pod you're trying to connect to is running an SSH daemon, right? This is not magic, and won't work if it's not.
Note that the SSH connection goes via the Kubernetes API server, so don't do anything too involved.
For example: don't run rsync
over the connection or anything.
See https://blog.differentpla.net/blog/2023/02/28/kubectl-ssh-plugin/.