Sandbox
@txn2/kubefwd

Bulk Kubernetes port forwarding for local development

kubefwd discovers services in one or more Kubernetes namespaces, assigns each service a unique loopback IP, and writes host entries so you can reach them by service name. It manages the port forwards, reconnects when connections drop, and can show live status in a TUI or expose a REST API.

4,167 stars235 forksGoUpdated 8d ago
Who it's for

Builders who need local access to Kubernetes services without rewriting connection settings.

What it delivers

You can work against cluster services from your laptop using the same hostnames and ports your app already expects.

What it does

Bulk service forwarding

Forwards all services in a namespace with one command instead of setting up each port by hand.

Unique loopback IPs

Gives each service its own 127.x.x.x address to avoid port conflicts.

Service name resolution

Updates local host resolution so you can call services by their in-cluster names.

Auto reconnect

Restarts forwards when pods restart or connections drop.

Interactive TUI

Shows service status, traffic, and logs in a terminal interface.

REST API

Exposes HTTP endpoints for programmatic control.

MCP integration

Lets Claude Code and Cursor connect to the forwarding workflow through MCP.

How to get it

  1. 1Run
    # Install (macOS)
    brew install kubefwd
    
    # Forward all services in a namespace with the interactive TUI
    sudo -E kubefwd svc -n my-namespace --tui
  2. 2macOS
    brew install kubefwd
  3. 3Windows
    winget install txn2.kubefwd
    # or
    scoop install kubefwd
  4. 4Docker
    docker run -it --rm --privileged \
      -v "$HOME/.kube:/root/.kube:ro" \
      txn2/kubefwd services -n my-namespace --tui

README

kubefwd (Kube Forward)

kubefwd - kubernetes bulk port forwarding

CNCF Landscape GitHub license codecov Go Report Card GitHub release GitHub Downloads OpenSSF Scorecard OpenSSF Best Practices SLSA 3

Documentation | Getting Started | User Guide | API Reference | MCP (AI Integration)

Develop Locally, Connect to Kubernetes

kubefwd enables developers to work on their local machine while seamlessly accessing services running in a Kubernetes cluster. If you're building a new API that needs to connect to a database at db:5432, an auth service at auth:443, and a cache at redis:6379, all running in your development cluster, kubefwd makes them available locally by their service names, exactly as they would appear in-cluster. No environment-specific configuration, no local service setup, no Docker Compose files. Just run kubefwd and your application's existing connection strings work.

This is the essential use case: reduce or eliminate environment-specific connection setup and configurations during local development. Your code uses http://api-gateway:8080 in production? It works the same way on your laptop with kubefwd.

Bulk Kubernetes port forwarding with an interactive TUI, unique IPs per service, and automatic reconnection.

kubefwd is a command-line utility that bulk port forwards Kubernetes services to your local workstation. Each service gets its own unique loopback IP (127.x.x.x), eliminating port conflicts and enabling realistic local development with cluster services accessible by name.

kubefwd TUI - Main View

Quick Start

# Install (macOS)
brew install kubefwd

# Forward all services in a namespace with the interactive TUI
sudo -E kubefwd svc -n my-namespace --tui

Press ? for help, q to quit. See Getting Started for detailed installation and setup.

How It Works

kubefwd - Kubernetes Port Forward Diagram

kubefwd discovers services in your namespace, assigns each a unique loopback IP, updates /etc/hosts with service names, and establishes port forwards through the Kubernetes API. Access services by name just like in-cluster:

curl http://api-service:8080
mysql -h database -P 3306
redis-cli -h cache -p 6379

Features

  • Interactive TUI: Real-time service monitoring with traffic metrics
  • Unique IP per Service: Each service gets its own 127.x.x.x address
  • Auto-Reconnect: Reconnects when pods restart or connections drop
  • Bulk Forwarding: Forward all services in a namespace with one command
  • Live Traffic Monitoring: See bytes in/out and HTTP activity
  • Pod Log Streaming: View container logs in the TUI
  • REST API: Programmatic control via HTTP endpoints
  • MCP Support: Integration with AI assistants (Claude Code, Cursor)

Installation

macOS:

brew install kubefwd

Linux: Download .deb, .rpm, or .tar.gz from releases

Windows:

winget install txn2.kubefwd
# or
scoop install kubefwd

Docker:

docker run -it --rm --privileged \
  -v "$HOME/.kube:/root/.kube:ro" \
  txn2/kubefwd services -n my-namespace --tui

Usage

# Interactive mode (recommended)
sudo -E kubefwd svc -n default --tui

# Multiple namespaces
sudo -E kubefwd svc -n default,staging --tui

# Filter by label
sudo -E kubefwd svc -n default -l app=api --tui

# With REST API enabled
sudo -E kubefwd svc -n default --tui --api

Why kubefwd?

Unlike kubectl port-forward, kubefwd:

Featurekubectl port-forwardkubefwd
Services per commandOneAll in namespace
IP allocationlocalhost onlyUnique IP per service
Port conflictsManual managementNone (unique IPs)
Service name resolutionNot supportedAutomatic (/etc/hosts)
Auto-reconnectNoYes
Real-time monitoringNoTUI with metrics

See Comparison for detailed comparisons with Telepresence, mirrord, and other tools.

Documentation

Full documentation at kubefwd.com:

Requirements

  • kubectl configured with cluster access
  • Root/sudo access (for /etc/hosts and network interfaces)

Contributing

We welcome contributions for bug fixes, tests, and documentation. Feature development is limited to maintainers. See CONTRIBUTING.md.

License

Apache License 2.0


Open source by Craig Johnston, sponsored by Deasil Works, Inc.

Files in the repo

Repository payload32 top-level entries
  • .github
  • cmd
  • docs
  • mcpb
  • pkg
  • scripts
  • test
  • .gitignore
  • .golangci.yml
  • .goreleaser.yml
  • CHANGELOG.md
  • CLAUDE.md
  • CODE_OF_CONDUCT.md
  • codecov.yml
  • CONTRIBUTING.md
  • DESIGN.md
  • Dockerfile.alpine
  • Dockerfile.ubuntu
  • example.fwdconf.yml
  • glama.json
  • go.mod
  • go.sum
  • kubefwd-mast2.jpg
  • LICENSE
  • Makefile
  • mkdocs.yml
  • NOTICE
  • README_PACKAGING.md
  • README.md
  • SECURITY.md
  • server.json
  • smithery.yaml

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More tools

JuliusBrussee/
caveman

🪨 why use many token when few token do trick — Claude Code skill that cuts 65% of tokens by talking like caveman

105k
1 add
MemPalace/
mempalace

The best-benchmarked open-source AI memory system. And it's free.

59k
stablyai/
orca

Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

66k

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

132k

Never stop coding. Free MIT AI gateway: one endpoint, 352 providers (150+ free), 1200+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 550+ contributors

64k
headroomlabs-ai/
headroom

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

71k