Skip to content

kubectl proxy

kubectl proxy is a command that creates a proxy server or application-level gateway between the local host and the Kubernetes API server.^[400-devops__06-Kubernetes__k8s-ithelp__Day5__README.md]

This utility facilitates access to the Kubernetes API, particularly when interacting with Web-based UI tools or services running inside the cluster.

Usage and Access

When executed, the command starts a service listening on a specific local port, by default 127.0.0.1:8001.^[400-devops__06-Kubernetes__k8s-ithelp__Day5__README.md]

kubectl proxy
# Starting to serve on 127.0.0.1:8001

Once the proxy is running, resources within the cluster can be accessed via the browser or command line tools using localhost. This is commonly used to access the Kubernetes Dashboard without exposing the API server publicly.^[400-devops__06-Kubernetes__k8s-ithelp__Day5__README.md]

Example URL

For instance, after starting the proxy, the Kubernetes Dashboard can be accessed at a URL resembling the following structure^[400-devops__06-Kubernetes__k8s-ithelp__Day5__README.md]:

http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

Sources

^[400-devops__06-Kubernetes__k8s-ithelp__Day5__README.md]