sshpod makes Kubernetes Pods reachable from your existing OpenSSH client. It spins up a short-lived sshd inside the target container via kubectl exec, then connects to it through kubectl port-forward using *.sshpod hostnames defined in your SSH config.
curl -fsSL https://raw.githubusercontent.com/pfnet-research/sshpod/main/install.sh | sh -s -- --yesInstalls the latest release to ~/.local/bin (override with --prefix) and runs sshpod configure without prompting when --yes is supplied.
PowerShell 5+:
Set-ExecutionPolicy Bypass -Scope Process -Force; `
& ([scriptblock]::create((irm https://raw.githubusercontent.com/pfnet-research/sshpod/main/install.ps1))) -YesRemove -Yes to be prompted before updating ~/.ssh/config.
- Download the release asset for your OS/arch (
.tar.gzfor Linux/macOS,.zipfor Windows) and place the binary on your PATH (for example~/.local/bin/sshpodor~/.local/bin/sshpod.exe). - Run
sshpod configure(backs up~/.ssh/configand rewrites the sshpod block), or add the block below yourself—adjust the path if you installed elsewhere:
Host *.sshpod
ProxyCommand ~/.local/bin/sshpod proxy --host %h --user %r --port %p
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
GlobalKnownHostsFile /dev/null
CheckHostIP no
IdentityFile ~/.cache/sshpod/id_ed25519
IdentitiesOnly yes
BatchMode yes
ForwardAgent yesWith the ProxyCommand block in place, use ssh, scp, or sftp against *.sshpod hostnames:
ssh root@pod--api.namespace--default.context--prod.sshpod
ssh app@deployment--web.namespace--app.context--dev.sshpod
ssh app@container--sidecar.pod--debug.namespace--tools.context--dev.sshpod
scp ./local.tgz ubuntu@job--batch.namespace--etl.context--dev.sshpod:/tmp/.sshpodsuffix is required; no DNS entry is needed.- Targets:
pod--<pod>,deployment--<deployment>,job--<job>; deployments/jobs pick a ready Pod automatically. - Optional pieces:
container--<container>(required for multi-container Pods),namespace--<namespace>(falls back to the namespace set on the context, otherwise the cluster default),context--<context>(defaults to your currentkubectlcontext). - Pods running as non-root require you to SSH as that user; root Pods accept any SSH user.
- Local:
kubectlconfigured for the target cluster with permission toexecandport-forward; OpenSSH client tools (ssh/scp/sftp) andssh-keygen; ability to write to~/.ssh/configand~/.cache/sshpod. - In the container: Linux
amd64orarm64;shavailable;/tmpwritable.xz/gzipare optional—sshpod falls back to a plain transfer if needed—and the bundledsshdbinary must be allowed to run.
sshpod configurewrites aHost *.sshpodblock into~/.ssh/configwith a timestamped backup, pointing ProxyCommand at thesshpodbinary.- On first connect, sshpod creates
~/.cache/sshpod/id_ed25519, uploads an architecture-matchedsshdbundle to/tmp/sshpod/<pod-uid>/<container>, installs host keys, and starts the daemon on127.0.0.1. - A
kubectl port-forwardconnects your local SSH client to that in-podsshd; subsequent connections reuse the bundle and host keys while they remain in/tmp/sshpod.
make installbuilds the release binary, runssshpod configure, and installs under~/.local.make testandmake lintrun the test and lint suites.