This is a cache of https://docs.openshift.com/container-platform/3.9/architecture/networking/port_forwarding.html. It is a snapshot of the page at 2024-11-28T02:51:29.262+0000.
Port Forwarding - Networking | Architecture | OpenShift Container Platform 3.9
×

Overview

OpenShift Container Platform takes advantage of a feature built-in to Kubernetes to support port forwarding to pods. This is implemented using HTTP along with a multiplexed streaming protocol such as SPDY or HTTP/2.

Developers can use the cli to port forward to a pod. The cli listens on each local port specified by the user, forwarding via the described protocol.

Server Operation

The Kubelet handles port forward requests from clients. Upon receiving a request, it upgrades the response and waits for the client to create port forwarding streams. When it receives a new stream, it copies data between the stream and the pod’s port.

Architecturally, there are options for forwarding to a pod’s port. The supported implementation currently in OpenShift Container Platform invokes nsenter directly on the node host to enter the pod’s network namespace, then invokes socat to copy data between the stream and the pod’s port. However, a custom implementation could include running a "helper" pod that then runs nsenter and socat, so that those binaries are not required to be installed on the host.