public class PortForward extends Object
The protocol is undocumented as far as I can tell, but the PR that added it is here: github.com/kubernetes/kubernetes/pull/33684
And the protocol is:
web sockets on server/api/v1/namespaces/<namespace>/pods/<pod>/portforward with args ports=80 and ports=8080
I/O for first port (80) is on Channel 0 Err for first port (80) is on Channel 1 I/O for second port (8080) is on Channel 2 Err for second port (8080) is on Channel 3 < and so on for remaining ports>
The first two bytes of each output stream is the port that is being forwarded in little-endian format.
Modifier and Type | Class and Description |
---|---|
static class |
PortForward.PortForwardResult
PortForwardResult contains the result of an Attach call, it includes streams for stdout stderr
and stdin.
|
Constructor and Description |
---|
PortForward()
Simple PortForward API constructor, uses default configuration
|
PortForward(io.kubernetes.client.openapi.ApiClient apiClient)
PortForward API Constructor
|
Modifier and Type | Method and Description |
---|---|
PortForward.PortForwardResult |
forward(String namespace,
String name,
List<Integer> ports)
PortForward to a container.
|
PortForward.PortForwardResult |
forward(io.kubernetes.client.openapi.models.V1Pod pod,
List<Integer> ports)
PortForward to a container
|
io.kubernetes.client.openapi.ApiClient |
getApiClient()
Get the API client for these PortForward operations.
|
void |
setApiClient(io.kubernetes.client.openapi.ApiClient apiClient)
Set the API client for subsequent PortForward operations.
|
public PortForward()
public PortForward(io.kubernetes.client.openapi.ApiClient apiClient)
apiClient
- The api client to use.public io.kubernetes.client.openapi.ApiClient getApiClient()
public void setApiClient(io.kubernetes.client.openapi.ApiClient apiClient)
apiClient
- The new API client to use.public PortForward.PortForwardResult forward(io.kubernetes.client.openapi.models.V1Pod pod, List<Integer> ports) throws io.kubernetes.client.openapi.ApiException, IOException
pod
- The pod where the port forward is run.ports
- The ports to forwardio.kubernetes.client.openapi.ApiException
IOException
public PortForward.PortForwardResult forward(String namespace, String name, List<Integer> ports) throws io.kubernetes.client.openapi.ApiException, IOException
namespace
- The namespace of the Podname
- The name of the Podports
- The ports to forwardio.kubernetes.client.openapi.ApiException
IOException
Copyright © 2021. All rights reserved.