pod-ssh is a command-line utility for connecting to Kubernetes pods.
sudo curl -sSL \
https://raw.githubusercontent.com/eznix86/pod-ssh/main/pod-ssh \
-o /usr/local/bin/pod-ssh && \
sudo chmod +x /usr/local/bin/pod-sshEnsure /usr/local/bin is in your PATH.
Note: You can keep it as pod-ssh but it may also rename the script to any name you like, for example to kssh or pssh
The script will install these automatically if missing:
Supported platforms:
| Platform | gum install | kubectl install |
|---|---|---|
| macOS | Homebrew | Homebrew |
| Arch Linux | yay / paru / pacman | pacman |
| Debian/Ubuntu | apt + wget/tar | apt + curl |
| Other Linux | wget + tar | curl (generic binary) |
pod-ssh [COMMAND | POD@NAMESPACE]| Command | Description |
|---|---|
pod-ssh |
Interactive selection of namespace and pod |
pod-ssh help |
Show help |
pod-ssh history |
Show interactive history selection |
pod-ssh clear-history |
Clear connection history with confirmation |
pod-ssh last |
Reconnect to the most recent pod |
pod-ssh last~N |
Reconnect to the Nth most recent pod |
pod-ssh self-update |
Update the script from GitHub |
You can skip the interactive selection if you know the pod and namespace:
pod-ssh mypod@namespaceThe script will:
- Automatic ssh when matching the pod name or offer fuzzy matches interactively.
pod-ssh telemetry-app@telemetry-system->pod-ssh telemetry-app-d4fd85895-r27tg@telemetry-system
pod-ssh maintains simple text files in your home directory:
| File | Purpose |
|---|---|
~/.pod_ssh_history |
Stores unique pod@namespace combinations |
~/.pod_ssh_last |
Stores the last 20 connections in order |
These files enable the history and last commands for fast reconnection.
Interactive pod selection:
pod-sshReconnect to the last used pod:
pod-ssh lastReconnect to the third most recent pod:
pod-ssh last~3Clear your history:
pod-ssh clear-historyShow available commands:
pod-ssh helpThis project is open source and available under the MIT License.
Contributions are welcome. To propose changes:
- Fork the repository
- Create a new branch
- Submit a pull request with a clear description of your changes