liveBook · Manning

Port forwarding

Also called port-forward

Port forwarding is a networking technique that redirects traffic from a port on one endpoint to a port or service on another endpoint.

How 5 Manning books explain it

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
Enables local access to containerized and cluster-internal microservices for development, testing, and diagnosis.
How deep it goes
Demonstrates port mappings and commands, including service configuration, port conflicts, and the lifetime of a Kubernetes forward.
Examples
Uses a video-streaming container on port 3000 and a metadata pod forwarded from local port 6000 to port 80.
What you can do after
Apply port forwarding via Docker and kubectl to reach a container or test a cluster-internal microservice locally.

Read how Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform explains port forwarding →

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.

Read how Road to Kubernetes explains port forwarding →

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.

Read how ScyllaDB in Action explains port forwarding →

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.

Read how Google Anthos in Action explains port forwarding →

Also covered in

What to know first

Related concepts

Questions about port forwarding

What is 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.

Which Manning books explain port forwarding?

Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform, Kubernetes for Developers, Road to Kubernetes, ScyllaDB in Action and Google Anthos in Action.

What should I know before learning port forwarding?

Manning books that teach port forwarding usually introduce container and Python first.

What is the difference between port forwarding and service?

Port forwarding is a networking technique that redirects traffic from a port on one endpoint to a port or service on another endpoint. 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.

What is port forwarding also called?

Port forwarding is also called port-forward.

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.