kubefwd
llms.txt4.2k starsChanged 11 months agoApache-2.0View on GitHub
Kubernetes bulk port forwarding for local development. Forward services from any namespace to localhost with automatic /etc/hosts entries and unique IPs per service. kubefwd enables developers to work locally while accessing services running in Kubernetes. Each service gets its own unique loopback IP (127.x.x.x), eliminating port conflicts. Access cluster services by name—exactly as in-cluster. This guide covers installation and your first steps with kubefwd. By the end, you'll have cluster services accessible locally by name. kubefwd reads your kubeconfig (~/.kube/config…
- Installs packages
Trending
Quiet since June.about the whole repository
Who's talking about txn2/kubefwd
- NixOS/nixpkgs“kubefwd: /etc/hosts is not writeable”GitHub · Jun 27, 2025 · 4 reactions
- @josedevezas.com“This is probably obvious for everyone using #Kubernetes out there, but, for those it's not, you can use …”Bluesky · Dec 17, 2024 · 4 likes
- NixOS/nixpkgs“Package request: kubefwd”GitHub · Jan 24, 2024 · 4 reactions
- NixOS/nixpkgs“kubefwd: init at 1.22.5”GitHub · Feb 16, 2024 · 2 reactions
- avelino/awesome-go“Add kubefwd to DevOps Tools”GitHub · Jan 8, 2026 · 1 reactions
The biggest 5 of 46 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 46
Talked about on GitHub, Hacker News and Bluesky (46 times).
On GitHub · 44
- Jun 27, 2025kubefwd: /etc/hosts is not writeable — NixOS/nixpkgs4 reactions
- Jan 24, 2024Package request: kubefwd — NixOS/nixpkgs4 reactions
- Feb 16, 2024kubefwd: init at 1.22.5 — NixOS/nixpkgs2 reactions · 2 comments
- Jan 8, 2026Add kubefwd to DevOps Tools — avelino/awesome-go1 reaction · 2 comments
- May 11, 2020Connecting to a Kubernetes Service when running the operator locally — operator-framework/operator-sdk1 reaction · 11 comments
39 more on GitHub
- Jun 20, 2026kubefwd: 1.25.15 -> 1.25.16 — NixOS/nixpkgs0 reactions
- Jun 20, 2026chore(deps): update kubefwd to v1.25.16 — uniget-org/tools0 reactions · 3 comments
- Jun 20, 2026kubefwd 1.25.16 — Homebrew/homebrew-core0 reactions · 1 comment
- Jun 20, 2026chore(deps): update dependency txn2/kubefwd to v1.25.16 — ponkio-o/dotfiles0 reactions
- May 30, 2026chore(deps): update kubefwd to v1.25.15 — uniget-org/tools0 reactions · 3 comments
- May 29, 2026kubefwd: 1.25.14 -> 1.25.15 — NixOS/nixpkgs0 reactions · 2 comments
- May 29, 2026chore(deps): update dependency txn2/kubefwd to v1.25.15 — ponkio-o/dotfiles0 reactions
- May 29, 2026kubefwd 1.25.15 — Homebrew/homebrew-core0 reactions · 1 comment
- Apr 24, 2026kubefwd: 1.25.13 -> 1.25.14 — NixOS/nixpkgs0 reactions
- Apr 22, 2026kubefwd 1.25.14 — Homebrew/homebrew-core0 reactions · 1 comment
- Apr 20, 2026kubefwd v1.25.13: SHA-256 mismatch on macOS arm64 (and likely all platforms) — formula references stale checksum — txn2/homebrew-tap0 reactions · 1 comment
- Mar 29, 2026kubefwd 1.25.13 — Homebrew/homebrew-core0 reactions · 1 comment
- Feb 10, 2026kubefwd 1.25.12 — Homebrew/homebrew-core0 reactions · 1 comment
- Feb 10, 2026kubefwd: 1.25.9 -> 1.25.13 — NixOS/nixpkgs0 reactions · 4 comments
- Feb 4, 2026kubefwd 1.25.10 — Homebrew/homebrew-core0 reactions · 1 comment
- Jan 8, 2026New package: txn2.kubefwd version 1.25.9 — microsoft/winget-pkgs0 reactions · 4 comments
- Jan 6, 2026Add kubefwd to Productivity Tools — wmariuss/awesome-devops0 reactions
- Jan 6, 2026Add kubefwd - Kubernetes bulk port forwarding with TUI — toolleeo/awesome-cli-apps-in-a-csv0 reactions
- Jan 4, 2026chore(deps): update dependency txn2/kubefwd to v1.25.8 — uniget-org/tools0 reactions · 3 comments
- Jan 4, 2026chore(deps): update dependency txn2/kubefwd to v1.25.8 — ponkio-o/dotfiles0 reactions
- Jan 4, 2026kubefwd: 1.22.5 -> 1.25.9 — NixOS/nixpkgs0 reactions · 13 comments
- Jan 4, 2026[BUG]: kubefwd: Autoupdate broken due to missing 'v' prefix in URL pattern — ScoopInstaller/Main0 reactions
- Jan 3, 2026[BUG]: kubefwd: Autoupdate broken due to missing 'v' prefix in URL pattern — ScoopInstaller/Main0 reactions · 1 comment
- Dec 30, 2025chore(deps): update dependency txn2/kubefwd to v1.25.2 — ponkio-o/dotfiles0 reactions
- Dec 29, 2025chore(deps): update dependency txn2/kubefwd to v1.25.0 — uniget-org/tools0 reactions · 3 comments
- Dec 29, 2025chore(deps): update dependency txn2/kubefwd to v1.25.0 — ponkio-o/dotfiles0 reactions
- Dec 28, 2025feat(txn2/kubefwd): cosign config — aquaproj/aqua-registry0 reactions · 1 comment
- Dec 28, 2025chore(deps): update dependency txn2/kubefwd to v1.24.1 — uniget-org/tools0 reactions · 3 comments
- Dec 28, 2025chore(deps): update dependency txn2/kubefwd to v1.24.1 — ponkio-o/dotfiles0 reactions
- Dec 27, 2025chore(deps): update dependency txn2/kubefwd to v1.24.0 — uniget-org/tools0 reactions · 3 comments
- Dec 27, 2025chore(deps): update dependency txn2/kubefwd to v1.24.0 — ponkio-o/dotfiles0 reactions
- Dec 20, 2025chore(deps): update dependency txn2/kubefwd to v1.25.12 — killo431/tools0 reactions
- Dec 19, 2025chore(deps): update dependency txn2/kubefwd to v1.25.16 — ebesson/dotfiles0 reactions
- Dec 19, 2025Update dependency txn2/kubefwd to v1.25.16 - abandoned — CrystalMethod/dotfiles0 reactions · 1 comment
- Dec 18, 2025enhancement: support list of hosts added with the tool kubefwd — productdevbook/port-killer0 reactions
- Oct 12, 2021Kubernetes Tools — HarshadRanganathan/harshadranganathan.github.io0 reactions · 2 comments
- Apr 14, 2021Add kubefwd (bulk port forwarding) — nicholasdille/homebrew-tap0 reactions
- Dec 7, 2020Add kubefwd — nicholasdille/packages0 reactions
- Jun 21, 2019lorri services: prior art link collection — target/lorri0 reactions · 10 comments
On Hacker News · 1
- Nov 19, 2018Kubefwd: CLI utility for port forwarding pods within a Kubernetes namespace1 point
On Bluesky · 1
- Dec 17, 2024This is probably obvious for everyone using #Kubernetes out there, but, for those it's not, you can use kubefwd to expose services and… — @josedevezas.com4 likes and reposts
In this repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- docs/llms.txtllms.txt
The file
We split this llms-full.txt into the rules it gives an agent
7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 38
Run as Administrator for hosts file access.
- Distinctive: line 74
Start without pre-specified services and add them interactively:
- Distinctive: line 83
Use TUI to browse namespaces, select services, forward them
- Very specific: line 96
Start kubefwd in Idle Mode:
- Very specific: line 116
When kubefwd forwards a service:
- Distinctive: line 128
All port forward connections are closed
- Distinctive: line 386
Add to MCP config:
≈ “Common” is an estimate: at least 1 in 5 of the 1,484 llms.txt files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
# kubefwd
> Kubernetes bulk port forwarding for local development. Forward services from any namespace to localhost with automatic /etc/hosts entries and unique IPs per service.
kubefwd enables developers to work locally while accessing services running in Kubernetes. Each service gets its own unique loopback IP (127.x.x.x), eliminating port conflicts. Access cluster services by name—exactly as in-cluster.
---
# Getting Started
This guide covers installation and your first steps with kubefwd. By the end, you'll have cluster services accessible locally by name.
## Prerequisites
- **kubectl configured** with access to a Kubernetes cluster
- **Root/sudo access** (required for `/etc/hosts` and network interface modifications)
kubefwd reads your kubeconfig (`~/.kube/config` or `KUBECONFIG` environment variable) and connects directly to the Kubernetes API.
## Installation
### macOS
Using Homebrew:
```bash
brew install txn2/tap/kubefwd
```
### Windows
Using Scoop:
```powershell
scoop install kubefwd
```
Run as Administrator for hosts file access.
### Linux (Debian/Ubuntu)
Download the `.deb` package from GitHub Releases:
```bash
sudo dpkg -i kubefwd_*_amd64.deb
```
### Linux (RHEL/Fedora)
Download the `.rpm` package from GitHub Releases:
```bash
sudo rpm -i kubefwd_*_amd64.rpm
```
### Docker
```bash
docker run -it --rm --privileged \
-v "$HOME/.kube:/root/.kube:ro" \
txn2/kubefwd --tui
```
Verify installation:
```bash
kubefwd version
```
## Operating Modes
### Idle Mode (Recommended)
Start without pre-specified services and add them interactively:
```bash
sudo -E kubefwd --tui
```
In Idle Mode:
- REST API is enabled by default
- Auto-reconnect is enabled by default
- Use TUI to browse namespaces, select services, forward them
- Or use API to add services dynamically
### Classic Mode
Specify namespaces upfront. All services forwarded immediately:
```bash
sudo -E kubefwd svc -n default --tui
```
## Your First Forward
1. Start kubefwd in Idle Mode:
```bash
sudo -E kubefwd --tui
```
2. Browse namespaces: Press `f` to open the service browser, then select a namespace.
3. Forward services: Select individual services or press `a` to forward all.
4. Use your services:
```bash
curl http://my-api:8080/health
psql -h postgres -U admin -d mydb
redis-cli -h redis ping
```
5. Quit: Press `q` to exit. kubefwd cleans up automatically.
## What Happens Under the Hood
When kubefwd forwards a service:
1. **IP Allocation**: Each service gets a unique loopback IP (e.g., `127.1.27.1`)
2. **Hosts File Update**: Service names added to `/etc/hosts`
3. **Port Forwarding**: Creates port forwards to pods backing each service
4. **Ready to Use**: Applications connect using service names
### Cleanup
When kubefwd exits:
- `/etc/hosts` entries are removed
- Network interface aliases are cleaned up
- All port forward connections are closed
Original hosts file backed up to `~/hosts.original`.
## Why sudo -E?
kubefwd requires root privileges for:
- Modifying `/etc/hosts`
- Creating loopback IP aliases
- Binding to ports below 1024
The `-E` flag preserves environment variables, especially `KUBECONFIG`:
```bash
# Correct - preserves KUBECONFIG
sudo -E kubefwd --tui
# Wrong - may fail to find cluster config
sudo kubefwd --tui
```
## Enabling the REST API
**Idle Mode** (API enabled by default):
```bash
sudo -E kubefwd
sudo -E kubefwd --tui
```
**Classic Mode** (add `--api` flag):
```bash
sudo -E kubefwd svc -n default --api
```
API available at:
- `http://kubefwd.internal/api` - REST endpoints
- `http://kubefwd.internal/docs` - Interactive API documentation
---
# User Guide
The Terminal User Interface (TUI) transforms kubefwd into an interactive development companion.
## Interface Overview
### Main View
| Panel | Description |
|-------|-------------|
| **Services** | All forwarded services with status, namespace, local address, traffic |
| **Logs** | Real-time kubefwd activity, connection events, errors |
| **Status Bar** | Service counts, current filter, keyboard hints |
### Service Status Indicators
| Indicator | Meaning |
|-----------|---------|
| Green dot | Active and forwarding |
| Yellow dot | Connecting or reconnecting |
| Red dot | Error state |
## Keyboard Shortcuts
### Global
| Key | Action |
|-----|--------|
| `q` | Quit kubefwd |
| `?` | Toggle help overlay |
| `f` | Open namespace/service browser |
| `x` | Switch Kubernetes context |
| `/` | Filter services |
| `Esc` | Clear filter / Close modal |
### Navigation
| Key | Action |
|-----|--------|
| `j` / `↓` | Move down |
| `k` / `↑` | Move up |
| `g` / `Home` | Go to first item |
| `G` / `End` | Go to last item |
| `Tab` | Switch focus (services ↔ logs) |
### Service Actions
| Key | Action |
|-----|--------|
| `Enter` | Open detail view for selected service |
| `d` | Remove forward for selected service |
| `r` | Reconnect all errored services |
| `R` | Force reconnect selected service |
### Detail View
| Key | Action |
|-----|--------|
| `1` - `9` | Copy connection string #N to clipboard |
| `y` | Copy first connection string |
| `Tab` | Next tab |
| `Esc` / `q` | Close detail view |
## Auto-Reconnect
TUI enables auto-reconnect by default with exponential backoff:
```
1s → 2s → 4s → 8s → 16s → 32s → 64s → 128s → 256s → 300s (max)
```
Press `r` to force immediate reconnection of all errored services.
---
# Configuration
Complete reference for kubefwd command line flags.
## Essential Flags
| Flag | Short | Description |
|------|-------|-------------|
| `--namespace` | `-n` | Namespace(s) to forward services from |
| `--tui` | | Enable interactive terminal user interface |
| `--selector` | `-l` | Label selector to filter services |
| `--field-selector` | `-f` | Field selector to filter services |
| `--all-namespaces` | `-A` | Forward services from all namespaces |
## TUI and Behavior Flags
| Flag | Short | Default | Description |
|------|-------|---------|-------------|
| `--tui` | | false | Enable interactive TUI mode |
| `--auto-reconnect` | `-a` | true (TUI) | Automatically reconnect lost port forwards |
| `--verbose` | `-v` | false | Enable debug logging |
## Network Configuration
| Flag | Short | Description |
|------|-------|-------------|
| `--mapping` | `-m` | Port mapping (e.g., `-m 80:8080`) |
| `--reserve` | `-r` | Reserve specific IP for service |
| `--fwd-conf` | `-z` | Path to IP reservation config file |
| `--domain` | `-d` | Append domain suffix to hostnames |
## Examples
```bash
# Forward all services in a namespace with TUI
sudo -E kubefwd svc -n default --tui
# Multiple namespaces
sudo -E kubefwd svc -n frontend,backend,data --tui
# Filter by label
sudo -E kubefwd svc -n default -l app=api --tui
# Port mapping (80 → 8080)
sudo -E kubefwd svc -n default -m 80:8080 --tui
# IP reservation
sudo -E kubefwd svc -n default -r my-service.default:127.3.3.1 --tui
```
---
# REST API
kubefwd's REST API enables programmatic control over port forwarding.
## Quick Start
```bash
# Idle mode - API enabled by default
sudo -E kubefwd
# Test the API
curl http://kubefwd.internal/api/health
```
Base URL: `http://kubefwd.internal/api`
## Key Endpoints
### Health & Info
- `GET /api/health` - Health check
- `GET /api/info` - Server information
### Services
- `GET /api/v1/services` - List forwarded services
- `GET /api/v1/services/:key` - Get specific service
- `POST /api/v1/services` - Add service to forward
- `DELETE /api/v1/services/:key` - Stop forwarding
- `POST /api/v1/services/:key/reconnect` - Reconnect service
### Namespaces
- `GET /api/v1/namespaces` - List namespace watchers
- `POST /api/v1/namespaces` - Add namespace (forward all services)
- `DELETE /api/v1/namespaces/:key` - Remove namespace
### Kubernetes Discovery
- `GET /api/v1/kubernetes/contexts` - List kubeconfig contexts
- `GET /api/v1/kubernetes/namespaces` - List namespaces
- `GET /api/v1/kubernetes/services` - List services in namespace
- `GET /api/v1/kubernetes/pods/:namespace` - List pods
- `GET /api/v1/kubernetes/pods/:namespace/:pod/logs` - Get pod logs
### Metrics & Diagnostics
- `GET /api/v1/metrics` - Summary metrics
- `GET /api/v1/diagnostics` - Diagnostics summary
- `GET /api/v1/diagnostics/errors` - Current errors
### Events (SSE)
- `GET /api/v1/events` - Real-time event stream
---
# MCP Integration
## What is MCP?
The Model Context Protocol (MCP) lets AI assistants connect to external tools. kubefwd's MCP integration gives AI assistants full access to Kubernetes port forwarding.
## Platform Support
| Platform | Support |
|----------|---------|
| Claude Code | Full |
| Claude Desktop | Full |
| Cursor | Full |
| Windsurf | Full |
| VS Code Copilot | Full |
| Zed | Full |
| JetBrains IDEs | Full |
## Setup
### 1. Start kubefwd
```bash
sudo -E kubefwd --tui
```
### 2. Configure AI Client
**Claude Code:**
```bash
claude mcp add --transport stdio kubefwd -- kubefwd mcp
```
**Cursor/Windsurf/VS Code:**
Add to MCP config:
```json
{
"mcpServers": {
"kubefwd": {
"command": "kubefwd",
"args": ["mcp"]
}
}
}
```
## What Your AI Can Do
### Service Forwarding
- Forward entire namespaces
- Forward individual services
- Remove forwards
- Multi-context support
### Discovery & Connection
- List Kubernetes contexts
- List namespaces and services
- Get connection info (IPs, hostnames, env vars)
- Find services by name/port
### Pod Debugging
- List pods with status
- Get pod details and logs
- View Kubernetes events
- Check service endpoints
### Monitoring & Troubleshooting
- Quick status checks
- Traffic metrics
- Error diagnosis
- Reconnect services
## Example Conversations
**You:** "I need to connect to PostgreSQL in kft1"
**AI:** "Connected. Use: `psql -h postgres -U admin -d mydb`"
**You:** "Set up my environment for the checkout service"
**AI:** "Ready. Services available: cart-service:8080, payment-service:443, user-db:5432"
**You:** "My API calls to auth-service are failing"
**AI:** "The auth-service pod restarted. I've reconnected it. Try again."
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

