kubectl port-forward creates a local proxy to an application port on a Kubernetes pod or service. It is especially useful during development and troubleshooting because you can reach a pod without finding its IP address. section 5.3.1
Forward a local port to a pod
Run `kubectl port-forward kiada 8080` in one terminal, then run `curl localhost:8080` in another. Requests to local port 8080 travel through the proxy and return the application response from the pod. section 5.3.1
Use port forwarding for focused local access, while keeping its operational boundaries in mind:
- Forward several application ports together, such as HTTP 8080, HTTPS 8443, and an administration port 9901. section 5.4.3
- Access services through localhost with tools such as curl or a browser; HTTPS may require handling a self-signed certificate and hostname mismatch. section 5.4.3
- Remember that traffic crosses the local proxy, API server, and Kubelet before reaching the pod, so a broken path can prevent access even when the application is otherwise reachable. section 5.3.1
- Use `kubectl port-forward` with services as well as pods when the target should be a service rather than one specific pod. section 5.3.1
$ kubectl port-forward kiada-ssl 8080 8443 9901 Forwarding from 127.0.0.1:8080 -> 8080 Forwarding from [::1]:8080 -> 8080 Forwarding from 127.0.0.1:8443 -> 8443 Forwarding from [::1]:8443 -> 8443 Forwarding from 127.0.0.1:9901 -> 9901 Forwarding from [::1]:9901 -> 9901
Inspect a multi-port forwarding session and compare the local listeners created for the application. section 5.4.3

