kforward is a lightweight, simple CLI tool designed to streamline local development for applications interacting with Kubernetes services. Built with Go, it allows you to easily access services running inside your cluster using their standard service names, without the hassle of managing multiple kubectl port-forward sessions.
Features:
- CLI Interface: Simple command-line interface to start the proxy and specify targets.
- Kubeconfig Autodetection: Automatically uses your currently configured kubectl context.
- Context Override: Supports specifying a Kubernetes context via the --context flag.
- kubectl Process Management:
- Automatically finds ready pods for specified services.
- Starts kubectl port-forward processes in the background for required services/ports.
- Manages and terminates these background kubectl processes gracefully when kforward exits.
- Targeted Service Forwarding: Manages forwards for one or more specific services (namespace/service-name).
- Namespace-Wide Forwarding: Manages forwards for all non-headless services and their ports within a specified namespace.
- Local HTTP/HTTPS Proxy: Runs a local proxy server (default port 1080) that handles:
- Standard HTTP requests.
- HTTPS requests via the CONNECT method (TCP tunneling).
- Dynamic Connection Routing: Routes incoming proxy requests to the correct background kubectl port-forward process based on the requested service name and port.
- Configurable Proxy Port: Allows specifying a different local port for the HTTP/HTTPS proxy server using the --port flag.