必须用 sudo 运行,否则无法修改 /etc/hosts 和创建回环网络接口;需提前配置好 kubectl 的集群访问凭证;Docker 方式需加 --privileged 并挂载 ~/.kube

kubefwd
txn2Apache-2.0活跃维护一条命令把 Kubernetes 命名空间里的所有 Service 批量转发到本地端口,省去逐个 kubectl port-forward 的麻烦,方便本地开发直接访问集群服务。
Bulk port forwarding Kubernetes services for local development.
brew install kubefwd
sudo -E kubefwd svc -n my-namespace --tuiREADME 未说明显存或 GPU 要求;需要本机已配置可访问集群的 kubectl,并具备 root/sudo 权限以修改 /etc/hosts 和创建网络接口
把 Kubernetes 集群里的服务批量端口转发到本地,让本地代码直接用服务名连接集群服务
一条命令把 Kubernetes 命名空间里的所有 Service 批量转发到本地端口,省去逐个 kubectl port-forward 的麻烦,方便本地开发直接访问集群服务。
核心能力
- 一条命令转发整个命名空间的所有服务
- 每个服务分配独立 127.x.x.x 回环 IP,避免端口冲突
- 自动改写 /etc/hosts,实现按服务名访问
- Pod 重启或连接断开后自动重连
- 提供交互式 TUI,实时查看流量与容器日志
容易踩的坑
- v1.25.18kubefwd-v1.25.18最新正式版2026-10-16 · 2026-10-16 23:34 UTC
kubefwd v1.25.18
Security release. Everyone on v1.25.17 or earlier should upgrade.
v1.25.17 shipped with known vulnerabilities in
golang.org/x/net,golang.org/x/cryptoandgolang.org/x/text. This release updates those modules and has no other changes. It includes all of v1.25.17's bug fixes. See the v1.25.17 notes for those.Advisories fixed (#623)
Advisory Module Reachable from kubefwd Summary GO-2026-6617 x/net yes HTTP/2 server crash from an HPACK encoder race GO-2026-6612 x/net yes Double flow-control refund on HTTP/2 server streams GO-2026-6611 x/net yes Excessive CPU from repeated initial window changes GO-2026-6610 x/net yes HTTP/2 transport accepts malformed framing headers GO-2026-6603 x/net yes HTTP/2 server memory exhaustion from Trailer headers GO-2026-6355, GO-2026-6354 x/crypto no (ssh) DoS on deadlocked SSH channels GO-2026-6303 x/crypto no (ssh) SSH source-address option not enforced GO-2026-6629 x/text no (precis) Panic parsing crafted input "Reachable" is govulncheck's call-graph result for kubefwd's source.
Module v1.25.17 v1.25.18 golang.org/x/net0.57.0 0.60.0 golang.org/x/crypto0.54.0 0.57.0 golang.org/x/text0.40.0 0.42.0 golang.org/x/sync0.22.0 0.23.0 golang.org/x/term0.45.0 0.46.0 The integration-test module also moves to
x/crypto0.57.0 andx/sys0.48.0. That module isn't part of the binary.Verification
Built with Go 1.26.9.
govulncheckreports no vulnerabilities in:- kubefwd's source, the root module (
./...) - the integration-test module (
-tags=integration ./...) - an unstripped binary built from the release commit (
-mode binary)
Scanning the released binaries (
-mode binaryonkubefwd_Darwin_arm64andkubefwd_Linux_x86_64) reports one advisory, GO-2026-5932: thegolang.org/x/crypto/openpgppackage is deprecated, and no fixed version exists. This is a false positive:- kubefwd doesn't include the package.
go list -depson the release build configuration shows noopenpgppackage. - The scanner can't check symbols in release binaries. They're stripped (
-ldflags "-s -w"), so govulncheck falls back to matching the wholex/cryptomodule. - Stripping is the only difference. The same code built unstripped scans clean.
Check the build provenance of any asset:
gh attestation verify kubefwd_Darwin_arm64.tar.gz --repo txn2/kubefwdChecksums are in
kubefwd_checksums.txt, which also has a sigstore bundle.Install / upgrade
# Homebrew (macOS / Linux) brew upgrade kubefwd # or: brew install txn2/tap/kubefwd # Docker docker pull txn2/kubefwd:v1.25.18 # also :v1.25.18_alpine-3, :v1.25.18_ubuntu-24.04 # Or download a binary or package (deb, rpm, apk) for your platform from the assets below.Run it (requires root for /etc/hosts and loopback aliases):
sudo -E kubefwd svc -n <namespace> --tuiFull changelog: https://github.com/txn2/kubefwd/compare/v1.25.17...v1.25.18
- kubefwd's source, the root module (
- v1.25.17kubefwd-v1.25.172026-10-16 · 2026-10-16 22:06 UTC
查看更新说明
kubefwd v1.25.17
[!WARNING] Superseded by v1.25.18. Do not install this version. v1.25.17 shipped with known vulnerabilities in
golang.org/x/net. Five HTTP/2 advisories are reachable from kubefwd: GO-2026-6603, GO-2026-6610, GO-2026-6611, GO-2026-6612 and GO-2026-6617. It also has unreachable advisories inx/cryptoandx/text. v1.25.18 fixes all of them and includes every fix below.This release fixes three forwarding bugs:
- A goroutine and memory leak on idle forwards across sleep and wake.
- Forwards that kept pointing at the old port or pod after a Service was updated in place.
- Forwards that flapped when the API server interrupted a pod watch.
It also fixes a vulnerability in
golang.org/x/textthat kubefwd's own code reaches. It moves to the Kubernetes 0.37 client libraries and brings in four months of dependency updates.The fixes below are all included in v1.25.18. Install v1.25.18 instead.
Bug fixes
Idle forwards no longer leak goroutines and memory (#622, refs #614)
Reported by @avni-ef: memory grew from 74 MB to 1.48 GB over two days on a machine that slept and woke.
kubefwd keeps each forward's connection alive by pinging it every 30 seconds. Stopping the pinger sent a signal that gave up after 100 ms. If a ping was in flight on a connection that died during sleep, which can take up to 30 seconds, the signal was missed. That pinger then kept running against a dead connection forever, and every reconnect added another one.
Now:
- Stopping is reliable. The stop signal is a closed channel, which a pinger sees even when it is busy at that moment, so stopping never times out.
- Pinging stops on every exit path from a forward, including early errors.
- A pinger also ends on its own when its connection closes.
- A pinger never opens a new stream on a connection that is shutting down.
A regression test reproduces the leak against the old code. The approach comes from #619 by @AdamMagued.
The report also shows a second, smaller leak of SPDY connection goroutines. Its root cause is in the Kubernetes streaming library, not in kubefwd. This release makes it less likely to happen, and #614 stays open to track it.
In-place Service updates now rebuild forwards (#617, fixes #615)
Contributed and reported by @idan-rahamim-lendbuzz.
When a Service changed in place, kubefwd kept forwarding to the old target. This happened with a Helm upgrade that moved a port to a sidecar, a changed
targetPort, or a changed selector. Before, kubefwd only noticed a change in the number of ports, and even then it resynced from its stale copy of the Service. The only fix was a restart.Now:
- Port or selector changes: kubefwd compares the Service's ports and selector, stops the affected forwards, waits for their cleanup to finish, and rebuilds them from the new spec. A
targetPortchange and a selector change that moves the Service to different pods both take effect within about a second. - Selector removed: the Service's forwards stop.
- Selector added: a Service that previously had no selector, and was skipped, gets forwarded.
- Status-only and metadata-only updates are still ignored.
- TUI: shows a
ServiceUpdatedevent for each rebuild.
Two related fixes come with it. A finishing forward no longer removes a replacement registered under the same key. Pod syncs are serialized, so a rebuild can't interleave with a reconnect or resync.
Tested on a KIND cluster against v1.25.16:
Check v1.25.16 v1.25.17 Initial forward pass pass targetPort5678 → 5679still hits 5678 follows to 5679 Selector moved to a different deployment still hits the old pod follows to the new pod /etc/hostscleaned up on exitpass pass A rebuild can give the Service a new loopback IP. The hostname follows it, but connections open during the rebuild are dropped.
Pod watch interruptions no long
- v1.25.16kubefwd-v1.25.162026-06-20 · 2026-06-20 01:50 UTC
查看更新说明
kubefwd v1.25.16
This release modernizes the interactive Terminal UI by moving it onto the Charm v2 library line, hardens API-key startup logging, and rolls up routine dependency and CI maintenance.
Highlights
TUI migrated to Charm v2 (#527, closes #517)
The entire interactive TUI (
--tui) has been migrated from the v1 Charm libraries to their v2 equivalents under thecharm.land/...module path:Before After github.com/charmbracelet/bubbletea v1.3.10charm.land/bubbletea/v2 v2.0.7github.com/charmbracelet/lipgloss v1.1.0charm.land/lipgloss/v2 v2.0.4github.com/charmbracelet/bubbles v1.0.0charm.land/bubbles/v2 v2.1.0github.com/evertras/bubble-table v0.19.2github.com/evertras/bubble-table v0.22.3These are distinct, incompatible type systems, so this was a full API migration rather than a version bump. Notable changes handled under the hood:
View()returnstea.View- alt-screen and mouse capture moved from the removedtea.WithAltScreen()/tea.WithMouseCellMotion()program options to theAltScreen/MouseModefields on the returned view, applied on every render path.- Keys -
tea.KeyMsgis now an interface; all handlers (services, logs, detail, browse, and help) dispatch on the concretetea.KeyPressMsg. - Mouse -
tea.MouseMsgsplit intotea.MouseWheelMsg/tea.MouseClickMsg, with renamed button constants; all wheel-scroll and click-to-focus behavior preserved. - Styling -
lipgloss.Coloris now a function returningimage/color.Color; viewport sizing moved toSetWidth()/SetHeight()and option-based construction.
No user-facing behavior changes. All keyboard shortcuts (
j/k,Enter,Tab,/,r,b,?,q), traffic metrics, log streaming, theme switching, and auto-reconnect work exactly as before. The dark/light theme workaround was re-validated under lipgloss v2. Verified on ubuntu + macOS withgo build,go vet,golangci-lint(0 issues), and the full test suite.API-key authentication: docs and safer startup logging (#526)
Follow-up to the API-key auth feature (#508):
- Security: the API key is now only printed at startup when kubefwd generated it. A user-supplied
KUBEFWD_API_KEYis referenced by name and never echoed to logs. - Docs: the Authentication sections of
openapi.yaml,api-reference.md, andmcp-integration.mdwere rewritten to cover the Bearer header,KUBEFWD_API_KEY/kubefwd mcp --api-key, the/api/healthexemption, and the401response.
Dependency updates
k8s.io/streaming0.36.1 -> 0.36.2 (#523)k8s.io/kubectl0.36.1 -> 0.36.2 (#525)k8s.io/cli-runtime0.36.1 -> 0.36.2 (#522)golang.org/x/sys0.45.0 -> 0.46.0 (#518)github.com/txn2/txeh1.8.0 -> 1.8.1 (#516)github.com/quic-go/quic-gobump (#511)
CI / build
codecov/codecov-action6.0.1 -> 7.0.0 (#521)github/codeql-action4.36.0 -> 4.36.1 -> 4.36.2 (#512, #520)actions/checkout6.0.2 -> 6.0.3 (#514)docker/setup-qemu-action4.0.0 -> 4.1.0 (#513)
Install / upgrade
# Homebrew (macOS / Linux) brew install txn2/tap/kubefwd brew upgrade kubefwd # Or download a binary for your platform from the assets below.Run it (requires root for /etc/hosts and loopback aliases):
sudo -E kubefwd svc -n <namespace> --tuiFull changelog: https://github.com/txn2/kubefwd/compare/v1.25.15...v1.25.16
- v1.25.15kubefwd-v1.25.152026-05-29 · 2026-05-29 20:06 UTC
查看更新说明
kubefwd v1.25.15
Highlights
🔒 REST API now requires authentication (security)
The optional REST API (
--api) and the HTTP MCP bridge previously served every endpoint — Kubernetes context enumeration, pod log reads, and port-forward creation — with no authentication. Because kubefwd runs as root viasudo -E, any local process could drive it against your kubeconfig. This release adds Bearer-token authentication, addressing advisory GHSA-vwjh-p4vp-9rp2 (#507, #508).- The API key is resolved from
KUBEFWD_API_KEY; if unset, a random 32-character hex key is generated and only its last 4 characters are logged on startup. - All endpoints require
Authorization: Bearer <key>except/api/health, which stays open for liveness probes. - Token comparison uses
crypto/subtle.ConstantTimeCompareto avoid timing side channels. kubefwd mcpreadsKUBEFWD_API_KEYautomatically; a new--api-keyflag overrides it.
[!IMPORTANT] Upgrade note: If you use
--apior the HTTP MCP bridge, set a known key so automation/CI can authenticate instead of scraping a generated one from logs:export KUBEFWD_API_KEY=my-known-key sudo -E kubefwd svc -n my-namespace --api🐛 Multi-port services recover after a single port is reset (#509)
Fixed an unrecoverable zombie state in which a multi-port service that lost one port's connection — e.g. the TCP RST behavior of kubernetes/kubernetes#111825 — would never re-establish that port or restore its
/etc/hostsentries. Auto-reconnect (-a, on by default in--tui) found the pod but did nothing, and only a fullkubefwdrestart recovered the service.syncNormalServicenow reasons in terms of the pod being forwarded rather than a single port: it keeps every port of that pod and re-establishes any that were torn down independently. This also fixes a related regression where a healthy multi-port service could drop all but one port on the periodic resync. (#509, #510)Dependencies
golang.org/x/sys→ 0.45.0 (#502)github.com/modelcontextprotocol/go-sdk→ 1.6.1 (#501)
CI / Build
goreleaser/goreleaser-action→ 7.2.2 (#500)github/codeql-action→ 4.36.0 (#504, #499)golangci/golangci-lint-action→ 9.2.1 (#506)docker/setup-buildx-action→ 4.1.0 (#505)docker/login-action→ 4.2.0 (#503)codecov/codecov-action→ 6.0.1 (#498)
Full changelog: https://github.com/txn2/kubefwd/compare/v1.25.14...v1.25.15
- The API key is resolved from
- v1.25.14kubefwd-v1.25.142026-04-22 · 2026-04-22 08:23 UTC
查看更新说明
What's New
MCP Registry Publish Fix (#470)
Fixes the Publish to MCP Registry step in the release workflow that had been failing on every release since v1.25.1.
server.jsonused the snake_case keyfile_sha256, but the MCP registry schema requires camelCasefileSha256. The workflow now also validatesserver.jsonagainst the official MCP schema (plus an explicit MCPB contract check forfileSha256) before publishing, preventing the class of bug that caused the v1.25.13 homebrew formula SHA drift.Dependency Updates
Kubernetes
k8s.io/cli-runtime0.35.2 → 0.35.3k8s.io/kubectl0.35.2 → 0.35.3
Go Modules
github.com/moby/spdystream0.5.0 → 0.5.1 (header-size/count limits, 24-bit frame length enforcement)github.com/modelcontextprotocol/go-sdk1.4.1 → 1.5.0golang.org/x/sys0.42.0 → 0.43.0
CI
actions/setup-go6.3.0 → 6.4.0actions/upload-artifact7.0.0 → 7.0.1actions/upload-pages-artifact4.0.0 → 5.0.0actions/deploy-pages4.0.5 → 5.0.0docker/login-action4.0.0 → 4.1.0github/codeql-action4.34.1 → 4.35.1sigstore/cosign-installer4.1.0 → 4.1.1
Docker
- Ubuntu base image digest bump (
186072b→84e77de)
Changelog
- 5eab2dc ci: fix MCP Registry publish step (fileSha256 field name) (#470)
- 8cfcbd9 deps: bump github.com/moby/spdystream from 0.5.0 to 0.5.1 (#460)
- af76b37 ci: bump actions/upload-pages-artifact from 4.0.0 to 5.0.0 (#459)
- 337d352 ci: bump actions/upload-artifact from 7.0.0 to 7.0.1 (#458)
- eaffc2a deps: bump golang.org/x/sys from 0.42.0 to 0.43.0 (#457)
- 0ab9d85 docker: bump ubuntu from
186072bto84e77de(#456) - bd6e739 ci: bump docker/login-action from 4.0.0 to 4.1.0 (#455)
- a2469b1 deps: bump github.com/modelcontextprotocol/go-sdk from 1.4.1 to 1.5.0 (#454)
- 1f8cd06 ci: bump CI dependencies (combined) (#453)
- ac6b038 deps: bump k8s.io/cli-runtime and k8s.io/kubectl from 0.35.2 to 0.35.3 (#447)
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
kubefwd (Kube Forward)

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.

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 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:
| Feature | kubectl port-forward | kubefwd |
|---|---|---|
| Services per command | One | All in namespace |
| IP allocation | localhost only | Unique IP per service |
| Port conflicts | Manual management | None (unique IPs) |
| Service name resolution | Not supported | Automatic (/etc/hosts) |
| Auto-reconnect | No | Yes |
| Real-time monitoring | No | TUI with metrics |
See Comparison for detailed comparisons with Telepresence, mirrord, and other tools.
Documentation
Full documentation at kubefwd.com:
- Getting Started - Installation and setup
- User Guide - Interface and shortcuts
- Configuration - CLI options
- Advanced Usage - Multi-cluster, selectors
- REST API - API reference
- MCP Integration - AI assistant setup
- Troubleshooting - Common issues
- Architecture - Technical details
- Comparison - vs Telepresence, mirrord
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
Open source by Craig Johnston, sponsored by Deasil Works, Inc.