Port forwarding exposes a service running in a Kubernetes cluster through a port on the local machine, enabling local application previews. In a minikube workflow, a service can be forwarded to localhost even after being exposed as a NodePort. section 12.3.1
A local preview workflow typically:
- Starts minikube and creates a Deployment. section 12.3.1
- Exposes the Deployment through a NodePort service and verifies the service. section 12.3.1
- Forwards service port 8080 to local port 8080, then opens http://localhost:8080. section 12.3.1
- Uses Skaffold to include port forwarding as part of a broader development pipeline alongside deployment, file synchronization, log tailing, and cleanup. section 12.3.2
Forward a minikube service
After creating and exposing the hello-minikube Deployment, run `kubectl port-forward service/hello-minikube 8080:8080`. The command forwards localhost port 8080 to the service and reports listeners on 127.0.0.1 and ::1. section 12.3.1
kubectl port-forward service/hello-minikube 8080:8080 Forwarding from 127.0.0.1:8080 -> 8080 Forwarding from [::1]:8080 -> 8080
Use the command listing to inspect the exact kubectl syntax and forwarding output. section 12.3.1




