Kubefwd

io.github.txn2由 GitHub 账号 txn2 发布v1.25.18更新于 Oct 24, 2026

Kubernetes port forwarding for local development with automatic /etc/hosts entries.

概览

AI 生成的概览

Kubefwd 将 Kubernetes 服务批量端口转发到本机,分配独立回环 IP 并写入 /etc/hosts,并通过 MCP 提供给 AI 助手使用。

可以做什么
  • 将一个或多个 Kubernetes 命名空间中的服务批量转发到本地回环地址,可按标签筛选。
  • 通过自动写入的 /etc/hosts 条目,用集群内服务名访问服务,使现有连接字符串在本地直接可用。
  • 在交互式终端界面中监控服务、流量与容器日志,并在连接中断时自动重连。
  • 通过内置 REST API 以编程方式控制转发,MCP 集成即以此向 Claude Code、Cursor 等助手提供能力。
适用场景
适合在本地开发时需要连接 Kubernetes 开发集群中服务的场景,并希望由助手来建立或查看转发,而不是逐个手动执行 kubectl port-forward。也适合需要同时按名称访问多个服务的工作流。
运行要求
作为本地进程在桌面运行(macOS、Windows、Linux 安装包或 Docker)。需要已配置集群访问权限的 kubectl,以及 root/sudo 权限以修改 /etc/hosts 并创建网络接口。未声明环境变量、请求头或认证方式。
安装前请注意
需要 sudo 权限,会修改系统 /etc/hosts 和回环网络接口,影响整台机器。它会为本地进程打开通往集群服务的网络通道,可能暴露内部数据库或认证服务。可选的 REST API 提供对转发的编程控制。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Kubefwd,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

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

bash
# Install (macOS)brew install kubefwd
# Forward all services in a namespace with the interactive TUIsudo -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:

bash
curl http://api-service:8080mysql -h database -P 3306redis-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:

bash
brew install kubefwd

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

Windows:

powershell
winget install txn2.kubefwd# orscoop install kubefwd

Docker:

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

Usage

bash
# Interactive mode (recommended)sudo -E kubefwd svc -n default --tui
# Multiple namespacessudo -E kubefwd svc -n default,staging --tui
# Filter by labelsudo -E kubefwd svc -n default -l app=api --tui
# With REST API enabledsudo -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.

来源:README.md,提交 a4dc494

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

2
  1. v1.25.18最新Oct 17, 2026
  2. v1.25.16Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分