KubectlPortForwardSettings Class

Summary

Forward one or more local ports to a pod. This command requires the node to have 'socat' installed. Use resource type/name such as deployment/mydeployment to select a pod. Resource type defaults to 'pod' if omitted. If there are multiple pods matching the criteria, a pod will be selected automatically. The forwarding session ends when the selected pod terminates, and rerun of the command is needed to resume forwarding.
Assembly
Cake.Kubectl.dll
Namespace
Cake.Kubectl
Base Types
graph BT Type-->Base0["AutoToolSettings"] click Base0 "/api/Cake.Kubectl/AutoToolSettings" Base0-->Base1["ToolSettings"] Type["KubectlPortForwardSettings"] class Type type-node

Syntax

public sealed class KubectlPortForwardSettings : AutoToolSettings

Examples

# Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod kubectl port-forward pod/mypod 5000 6000 # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the deployment kubectl port-forward deployment/mydeployment 5000 6000 # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the service kubectl port-forward service/myservice 5000 6000 # Listen on port 8888 locally, forwarding to 5000 in the pod kubectl port-forward pod/mypod 8888:5000 # Listen on port 8888 on all addresses, forwarding to 5000 in the pod kubectl port-forward --address 0.0.0.0 pod/mypod 8888:5000 # Listen on port 8888 on localhost and selected IP, forwarding to 5000 in the pod kubectl port-forward --address localhost,10.19.21.23 pod/mypod 8888:5000 # Listen on a random port locally, forwarding to 5000 in the pod kubectl port-forward pod/mypod :5000

Attributes

Type Description
CompilerGeneratedAttribute

Constructors

Properties

Name Value Summary
Address string
--address Addresses to listen on (comma separated). Only accepts IP addresses or localhost as a value. When localhost is supplied, kubectl will try to bind on both 127.0.0.1 and ::1 and will fail if neither of these addresses are available to bind.
PodRunningTimeout string
--pod-running-timeout The length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running

Extension Methods

Name Value Summary
Dump<KubectlPortForwardSettings>() string
Get a basic string representation of specified object.
Requires the Cake.Incubator addin
IsIn<KubectlPortForwardSettings>(KubectlPortForwardSettings[]) bool
Checks if the source is contained in a list
Requires the Cake.Incubator addin
NotNull<KubectlPortForwardSettings>(string) void
Throws an exception if the specified parameter's value is null.
Requires the Cake.Ftp addin
NotNull<KubectlPortForwardSettings>(string) void
Throws an exception if the specified parameter's value is null.
Requires the Cake.Issues addin
ThrowIfNull<KubectlPortForwardSettings>(string) T
Throws a System.ArgumentNullException if the value is null, otherwise returns the value
Requires the Cake.Incubator addin
ThrowIfNull<KubectlPortForwardSettings>(string, string) T
Throws a System.ArgumentNullException with a specific message if the value is null, otherwise returns the value
Requires the Cake.Incubator addin