Port forwarding
Port forwarding is a networking technique that redirects traffic from a port on one endpoint to a port or service on another endpoint.
Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform
Port forwarding is the redirection of network traffic arriving at one port to a designated port on another network endpoint.
- How it is used
- Provides local access to containerized microservices and temporary access to internal Kubernetes microservices for testing and diagnosis.
- How deep it goes
- Shows Docker and kubectl commands, port mappings, and basic verification; does not explain network-routing internals.
- Examples
- Uses a video-streaming container mapped from port 3000 to 3000 and a metadata pod forwarded from local port 6000 to port 80.
- What you can do after
- Operate/configure it with Docker or kubectl to reach a listening microservice and check its responses locally.
Kubernetes for Developers
Port forwarding maps a network port on one endpoint to a port on another endpoint so traffic can reach a service.
- How it is used
- Connects local development clients to container or Kubernetes services for testing and debugging.
- How deep it goes
- Explains host-to-service and host-to-container mappings with commands, access patterns, and a network-interface flag.
- Examples
- Uses a Python HTTP server, timeserver Kubernetes Service, localhost:8080, Redis on port 6379, and curl verification.
- What you can do after
- Apply it via kubectl or Docker to test services locally and connect external Docker containers to forwarded Kubernetes services.
Read how Kubernetes for Developers explains port forwarding →
Road to Kubernetes
Port forwarding is a networking technique that maps a local port to a port on a remote resource.
- How it is used
- Provides temporary local access for verifying a PostgreSQL database running in a Kubernetes cluster.
- How deep it goes
- Explains Pod, StatefulSet, and Service commands with port mappings, but stops short of in-cluster communication.
- Examples
- Uses postgres-0, a postgres StatefulSet, a postgres Service, port 3312, port 5432, and the psql client.
- What you can do after
- Operate/configure kubectl port forwarding and verify database access with a local PostgreSQL client.
ScyllaDB in Action
Port forwarding maps a port on one network endpoint to a port on another endpoint so that connections can reach a service.
- How it is used
- Enables a local application to reach a CQL service running inside a Docker container.
- How deep it goes
- Defines host-to-container mapping and applies it to Docker, but defers complicated multi-node workarounds.
- Examples
- Uses ScyllaDB 5.4 containers with mappings such as 9241:9042 and 9042:9042.
- What you can do after
- Operate/configure Docker port mappings so a local application can reach ScyllaDB during development.
Google Anthos in Action
Port forwarding is a networking technique that maps a port on one system to a port on another service or system.
- How it is used
- Enables local previews of services running in minikube or remote Kubernetes clusters.
- How deep it goes
- Shows the service-level kubectl command and local result, then places forwarding within Skaffold’s development pipeline.
- Examples
- Uses the hello-minikube Deployment, NodePort service, port 8080, and browser access at localhost.
- What you can do after
- Apply it via kubectl or Skaffold to preview a Kubernetes service from a local browser.
Related concepts
- kubectlused by · kubectl is the Kubernetes command-line client for communicating with the Kubernetes API and managing cluster resources.
- Dockerused by · Docker is a platform and ecosystem for building, distributing, and running applications in containers.
- servicecontrasts with · A Kubernetes Service is an API resource that provides stable network access and service discovery for a changing set of Pods or other specified destinations.
- docker runconfigured by · docker run is a Docker command that creates and starts a container from an image, with optional runtime configuration.
- Skaffoldconfigured by · Skaffold is a command-line tool that automates development workflows for building, deploying, and iterating on containerized applications.
- database drivercontrasts with · A database driver is client software that implements the interface or protocol an application uses to connect to and communicate with a database system.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.




