kubefwd

txn2Apache-2.0活跃维护

一条命令把 Kubernetes 命名空间里的所有 Service 批量转发到本地端口,省去逐个 kubectl port-forward 的麻烦,方便本地开发直接访问集群服务。

Bulk port forwarding Kubernetes services for local development.

v1.25.18发布于 2026-10-16 23:34 UTC4,182star +2 / 7 天239fork同步于 2026-11-10 17:40 UTC

怎么上手

由 README 提炼,执行前请确认
brew install kubefwd
sudo -E kubefwd svc -n my-namespace --tui
硬件要求按 README 说明

README 未说明显存或 GPU 要求;需要本机已配置可访问集群的 kubectl,并具备 root/sudo 权限以修改 /etc/hosts 和创建网络接口

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

把 Kubernetes 集群里的服务批量端口转发到本地,让本地代码直接用服务名连接集群服务

一条命令把 Kubernetes 命名空间里的所有 Service 批量转发到本地端口,省去逐个 kubectl port-forward 的麻烦,方便本地开发直接访问集群服务。

核心能力

  • 一条命令转发整个命名空间的所有服务
  • 每个服务分配独立 127.x.x.x 回环 IP,避免端口冲突
  • 自动改写 /etc/hosts,实现按服务名访问
  • Pod 重启或连接断开后自动重连
  • 提供交互式 TUI,实时查看流量与容器日志

容易踩的坑

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

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v1.25.18
  1. 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/crypto and golang.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)

    AdvisoryModuleReachable from kubefwdSummary
    GO-2026-6617x/netyesHTTP/2 server crash from an HPACK encoder race
    GO-2026-6612x/netyesDouble flow-control refund on HTTP/2 server streams
    GO-2026-6611x/netyesExcessive CPU from repeated initial window changes
    GO-2026-6610x/netyesHTTP/2 transport accepts malformed framing headers
    GO-2026-6603x/netyesHTTP/2 server memory exhaustion from Trailer headers
    GO-2026-6355, GO-2026-6354x/cryptono (ssh)DoS on deadlocked SSH channels
    GO-2026-6303x/cryptono (ssh)SSH source-address option not enforced
    GO-2026-6629x/textno (precis)Panic parsing crafted input

    "Reachable" is govulncheck's call-graph result for kubefwd's source.

    Modulev1.25.17v1.25.18
    golang.org/x/net0.57.00.60.0
    golang.org/x/crypto0.54.00.57.0
    golang.org/x/text0.40.00.42.0
    golang.org/x/sync0.22.00.23.0
    golang.org/x/term0.45.00.46.0

    The integration-test module also moves to x/crypto 0.57.0 and x/sys 0.48.0. That module isn't part of the binary.

    Verification

    Built with Go 1.26.9. govulncheck reports 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 binary on kubefwd_Darwin_arm64 and kubefwd_Linux_x86_64) reports one advisory, GO-2026-5932: the golang.org/x/crypto/openpgp package is deprecated, and no fixed version exists. This is a false positive:

    • kubefwd doesn't include the package. go list -deps on the release build configuration shows no openpgp package.
    • The scanner can't check symbols in release binaries. They're stripped (-ldflags "-s -w"), so govulncheck falls back to matching the whole x/crypto module.
    • 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/kubefwd
    

    Checksums 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> --tui
    

    Full changelog: https://github.com/txn2/kubefwd/compare/v1.25.17...v1.25.18

  2. 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 in x/crypto and x/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/text that 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 targetPort change 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 ServiceUpdated event 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:

    Checkv1.25.16v1.25.17
    Initial forwardpasspass
    targetPort 5678 → 5679still hits 5678follows to 5679
    Selector moved to a different deploymentstill hits the old podfollows to the new pod
    /etc/hosts cleaned up on exitpasspass

    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

  3. 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 the charm.land/... module path:

    BeforeAfter
    github.com/charmbracelet/bubbletea v1.3.10charm.land/bubbletea/v2 v2.0.7
    github.com/charmbracelet/lipgloss v1.1.0charm.land/lipgloss/v2 v2.0.4
    github.com/charmbracelet/bubbles v1.0.0charm.land/bubbles/v2 v2.1.0
    github.com/evertras/bubble-table v0.19.2github.com/evertras/bubble-table v0.22.3

    These are distinct, incompatible type systems, so this was a full API migration rather than a version bump. Notable changes handled under the hood:

    • View() returns tea.View - alt-screen and mouse capture moved from the removed tea.WithAltScreen() / tea.WithMouseCellMotion() program options to the AltScreen / MouseMode fields on the returned view, applied on every render path.
    • Keys - tea.KeyMsg is now an interface; all handlers (services, logs, detail, browse, and help) dispatch on the concrete tea.KeyPressMsg.
    • Mouse - tea.MouseMsg split into tea.MouseWheelMsg / tea.MouseClickMsg, with renamed button constants; all wheel-scroll and click-to-focus behavior preserved.
    • Styling - lipgloss.Color is now a function returning image/color.Color; viewport sizing moved to SetWidth() / 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 with go 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_KEY is referenced by name and never echoed to logs.
    • Docs: the Authentication sections of openapi.yaml, api-reference.md, and mcp-integration.md were rewritten to cover the Bearer header, KUBEFWD_API_KEY / kubefwd mcp --api-key, the /api/health exemption, and the 401 response.

    Dependency updates

    • k8s.io/streaming 0.36.1 -> 0.36.2 (#523)
    • k8s.io/kubectl 0.36.1 -> 0.36.2 (#525)
    • k8s.io/cli-runtime 0.36.1 -> 0.36.2 (#522)
    • golang.org/x/sys 0.45.0 -> 0.46.0 (#518)
    • github.com/txn2/txeh 1.8.0 -> 1.8.1 (#516)
    • github.com/quic-go/quic-go bump (#511)

    CI / build

    • codecov/codecov-action 6.0.1 -> 7.0.0 (#521)
    • github/codeql-action 4.36.0 -> 4.36.1 -> 4.36.2 (#512, #520)
    • actions/checkout 6.0.2 -> 6.0.3 (#514)
    • docker/setup-qemu-action 4.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> --tui
    

    Full changelog: https://github.com/txn2/kubefwd/compare/v1.25.15...v1.25.16

  4. 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 via sudo -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.ConstantTimeCompare to avoid timing side channels.
    • kubefwd mcp reads KUBEFWD_API_KEY automatically; a new --api-key flag overrides it.

    [!IMPORTANT] Upgrade note: If you use --api or 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/hosts entries. Auto-reconnect (-a, on by default in --tui) found the pod but did nothing, and only a full kubefwd restart recovered the service.

    syncNormalService now 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

  5. 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.json used the snake_case key file_sha256, but the MCP registry schema requires camelCase fileSha256. The workflow now also validates server.json against the official MCP schema (plus an explicit MCPB contract check for fileSha256) before publishing, preventing the class of bug that caused the v1.25.13 homebrew formula SHA drift.

    Dependency Updates

    Kubernetes

    • k8s.io/cli-runtime 0.35.2 → 0.35.3
    • k8s.io/kubectl 0.35.2 → 0.35.3

    Go Modules

    • github.com/moby/spdystream 0.5.0 → 0.5.1 (header-size/count limits, 24-bit frame length enforcement)
    • github.com/modelcontextprotocol/go-sdk 1.4.1 → 1.5.0
    • golang.org/x/sys 0.42.0 → 0.43.0

    CI

    • actions/setup-go 6.3.0 → 6.4.0
    • actions/upload-artifact 7.0.0 → 7.0.1
    • actions/upload-pages-artifact 4.0.0 → 5.0.0
    • actions/deploy-pages 4.0.5 → 5.0.0
    • docker/login-action 4.0.0 → 4.1.0
    • github/codeql-action 4.34.1 → 4.35.1
    • sigstore/cosign-installer 4.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 186072b to 84e77de (#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)

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    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 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.