Proxying and forwarding applications for debugging
In this section, we will learn how to publish the Kubernetes API directly on our desktop computer and reach any Service created in the cluster (if we have the appropriate permissions), and how to forward a Service directly to our client computer using the port-forward
feature.
Kubernetes client proxy feature
We use kubectl proxy
to enable the Kubernetes proxy feature. Some important options help us manage how and where the Kubernetes API will be accessible. We use the following options to define where the Kubernetes API will be published:
--address
: This option allows us to define the IP address of our client host used for publishing the Kubernetes API. By default,127.0.0.1
is used.--port
or-p
: This option is used to set the specific port where the Kubernetes API will be available. The default value is8001
, and although we can let Kubernetes use a random port by using-p=0
, it is recommended to always define a...