Esta página se muestra en inglés. Una traducción al español está en curso.
SkillsApr 16, 2026·3 min de lectura

Kubefwd — Bulk Port Forwarding for Kubernetes Services

A command-line tool that bulk-forwards Kubernetes services to your local machine, mapping service DNS names to localhost. Kubefwd lets developers access remote cluster services as if they were running locally.

Listo para agents

Instalación con revisión previa

Este activo requiere revisión. El prompt copiado pide dry-run, muestra escrituras y continúa solo tras confirmación.

Needs Confirmation · 64/100Política: confirmar
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
Kubefwd Overview
Comando con revisión previa
npx -y tokrepo@latest install 9d8da470-39d2-11f1-9bc6-00163e2b0d79 --target codex

Primero dry-run, confirma las escrituras y luego ejecuta este comando.

TL;DR
CLI tool that bulk-forwards Kubernetes services to localhost with real DNS name mapping.
§01

What it is

Kubefwd is a command-line tool that bulk-forwards Kubernetes services to your local machine and maps their DNS names to localhost. Instead of running kubectl port-forward for each service individually, kubefwd forwards all services in a namespace with a single command. Your local /etc/hosts is updated so you can access services by their Kubernetes DNS names as if they were running locally.

Kubefwd targets developers who work with multiple microservices on a remote Kubernetes cluster and want to run their local code against those services without modifying connection strings.

§02

How it saves time or tokens

Manually port-forwarding each service requires multiple terminal tabs and remembering which local port maps to which service. Kubefwd eliminates this by forwarding all services in a namespace at once and mapping their names to localhost. Your application config uses the same service names in development and production, reducing environment-specific bugs.

§03

How to use

  1. Install kubefwd:
brew install txn2/tap/kubefwd
  1. Forward all services in a namespace:
sudo kubefwd svc -n my-namespace
  1. Access services by their Kubernetes names:
curl http://my-api:8080/health
curl http://my-database:5432

The sudo is required because kubefwd modifies /etc/hosts to add DNS entries.

§04

Example

Forwarding specific services with label selectors:

# Forward only services with a specific label
sudo kubefwd svc -n dev -l app=backend

# Forward services from multiple namespaces
sudo kubefwd svc -n frontend -n backend

# Use a specific kubeconfig context
sudo kubefwd svc -n dev --context=staging-cluster

Once running, your application connects to http://user-service:3000 and the traffic routes to the pod in the cluster.

§05

Related on TokRepo

§06

Common pitfalls

  • Kubefwd requires root/sudo because it modifies /etc/hosts; on corporate machines with restricted permissions, this may be blocked
  • Services with the same name in different namespaces will conflict in /etc/hosts; use one namespace at a time or label selectors to avoid collisions
  • Kubefwd forwards to pods, not through Kubernetes service load balancing; if you need to test load balancing behavior, use the cluster directly

Preguntas frecuentes

Why does kubefwd require sudo?+

Kubefwd modifies your /etc/hosts file to map Kubernetes service names to 127.0.0.1. This requires root privileges on macOS and Linux. The hosts entries are cleaned up when kubefwd exits.

How does kubefwd differ from kubectl port-forward?+

kubectl port-forward handles one service at a time on a specified local port. Kubefwd forwards all services in a namespace simultaneously and maps their DNS names to localhost, so no port number management is needed.

Can I use kubefwd with Docker Desktop Kubernetes?+

Yes. Kubefwd works with any Kubernetes cluster accessible via kubeconfig, including Docker Desktop, minikube, kind, and remote clusters.

Does kubefwd work on Windows?+

Kubefwd primarily supports macOS and Linux. Windows support exists but requires running as Administrator to modify the hosts file. WSL2 is the recommended approach for Windows users.

What happens when kubefwd exits?+

Kubefwd cleans up all /etc/hosts entries and closes all port-forward connections when it exits. Your hosts file is restored to its original state.

Referencias (3)

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados