A powerful TUI (Terminal User Interface) application for managing Kubernetes port-forward connections with style.
- 🎨 Beautiful TUI - Cyberpunk-styled terminal interface
- 🔌 Multiple Connections - Manage many port-forwards simultaneously
- 📁 Profile Support - Save and quickly restore port-forward configurations
- 🔍 Interactive Selection - Navigate namespaces, pods, and services with ease
- ⚡ Fast & Lightweight - Single binary, no dependencies
- 🔄 Auto-reconnect - Easy reconnection of dropped connections
# Clone the repository
git clone https://github.com/pyqan/portFwd.git
cd portfwd
# Build
go build -o portfwd .
# Install to PATH (optional)
sudo mv portfwd /usr/local/bin/Simply run portfwd to start the interactive terminal interface:
portfwd# Forward local port 8080 to pod's port 80
portfwd forward -n default -p my-pod -l 8080 -r 80
# Forward using same port numbers
portfwd forward -n default -p nginx-pod -l 3000 -r 3000
# List pods in a namespace
portfwd list pods -n kube-system
# List namespaces
portfwd list namespaces| Key | Action |
|---|---|
↑/↓ or j/k |
Navigate |
n |
New port-forward |
d |
Disconnect selected |
D |
Disconnect all |
r |
Reconnect |
q |
Quit |
| Key | Action |
|---|---|
↑/↓ |
Navigate |
Enter |
Select |
Tab |
Switch Pods/Services |
Esc |
Go back |
/ |
Search |
| Key | Action |
|---|---|
Tab |
Next field |
Enter |
Confirm |
Esc |
Cancel |
Profiles allow you to save and quickly restore port-forward configurations.
Profiles are stored in ~/.config/portfwd/config.yaml:
profiles:
- name: development
description: Local development setup
forwards:
- namespace: default
pod: api-server-abc123
localPort: 8080
remotePort: 8080
- namespace: default
pod: postgres-xyz789
localPort: 5432
remotePort: 5432
- namespace: monitoring
service: grafana
localPort: 3000
remotePort: 3000
- name: debugging
description: Debug services
forwards:
- namespace: kube-system
pod: coredns-abc123
localPort: 9153
remotePort: 9153# List all profiles
portfwd profile list
# Show profile details
portfwd profile show development
# Start all forwards in a profile
portfwd profile start development
# Delete a profile
portfwd profile delete old-profile| Flag | Short | Description |
|---|---|---|
--namespace |
-n |
Kubernetes namespace |
--config |
-c |
Config file path |
Start the interactive TUI application.
Start a port-forward from command line.
portfwd forward -n <namespace> -p <pod> -l <local-port> [-r <remote-port>]
portfwd forward -n <namespace> -s <service> -l <local-port> [-r <remote-port>]| Flag | Short | Description |
|---|---|---|
--pod |
-p |
Pod name |
--service |
-s |
Service name |
--local |
-l |
Local port |
--remote |
-r |
Remote port (defaults to local) |
List Kubernetes resources.
portfwd list namespaces # or: portfwd list ns
portfwd list pods -n <namespace>
portfwd list services -n <namespace> # or: portfwd list svcManage port-forward profiles.
portfwd profile list
portfwd profile show <name>
portfwd profile start <name>
portfwd profile delete <name>Print version information.
portfwd/
├── main.go # CLI entry point
├── go.mod # Go module
├── internal/
│ ├── k8s/
│ │ └── client.go # Kubernetes API client
│ ├── portforward/
│ │ └── manager.go # Port-forward connection manager
│ ├── config/
│ │ └── config.go # Configuration & profiles
│ └── ui/
│ ├── app.go # Bubble Tea application
│ ├── styles.go # Lipgloss styles
│ └── views.go # UI components
└── README.md
- Bubble Tea - TUI framework
- Lip Gloss - Style definitions
- Bubbles - TUI components
- Cobra - CLI framework
- client-go - Kubernetes client
- Go 1.21+
- Access to a Kubernetes cluster
- Valid kubeconfig (
~/.kube/configorKUBECONFIGenv var)
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE for details.
Made with ❤️ for the Kubernetes community