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.
Installation avec revue préalable
Cet actif nécessite une revue. Le prompt copié demande un dry-run, affiche les écritures, puis continue seulement après confirmation.
npx -y tokrepo@latest install 9d8da470-39d2-11f1-9bc6-00163e2b0d79 --target codexDry-run d'abord, confirmez les écritures, puis lancez cette commande.
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.
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.
How to use
- Install kubefwd:
brew install txn2/tap/kubefwd
- Forward all services in a namespace:
sudo kubefwd svc -n my-namespace
- 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.
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.
Related on TokRepo
- AI Tools for DevOps — Kubernetes development and operations tools
- Automation Tools — developer workflow automation
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
Questions fréquentes
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.
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.
Yes. Kubefwd works with any Kubernetes cluster accessible via kubeconfig, including Docker Desktop, minikube, kind, and remote clusters.
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.
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.
Sources citées (3)
- Kubefwd GitHub— Kubefwd bulk port forwarding
- Kubernetes Docs— Kubernetes port forwarding documentation
- Kubefwd Docs— Kubefwd usage guide
En lien sur TokRepo
Fil de discussion
Actifs similaires
Ory Oathkeeper — Cloud Native Identity & Access Proxy
Ory Oathkeeper is an open source Identity and Access Proxy that authenticates, authorizes, and mutates incoming HTTP requests before forwarding them to upstream services, acting as a zero trust gateway.
Fluentd — Unified Logging Layer for Cloud-Native Infrastructure
Fluentd is a CNCF-graduated open-source data collector that unifies log collection and routing. With 1000+ plugins, it connects any source to any destination — the standard log layer for Kubernetes alongside Fluent Bit.
Valtio — Proxy-Based State Management for React
Valtio makes React state management simple by wrapping plain JavaScript objects in a proxy, so components automatically re-render when the properties they read change — no reducers, actions, or boilerplate required.
draw.io — Free Open-Source Diagramming Tool for Any Platform
draw.io is a free, browser-based diagramming application that supports flowcharts, UML, network diagrams, and more. Works offline as a desktop app on Windows, macOS, and Linux with no account required.