Proxy

The other command you can use to access your Pod is the kubectl proxy command. The proxy provides access not only to your Pod, but to all of the Kubernetes APIs as well. To invoke the proxy, run the following command:

kubectl proxy

And the output will show something akin to the following:

Starting to serve on 127.0.0.1:8001

Like the port-forward command, you won't get a prompt back in the Terminal window until the proxy terminates. While it is active, you can access Kubernetes REST API endpoints through this proxy. Open a browser and enter the URL http://localhost:8001/.

You should see a long list of URLs in JSON format, something akin to the following:

{  "paths": [    "/api",    "/api/v1",    "/apis",    "/apis/", "/apis/admissionregistration.k8s.io", ...

Get Kubernetes for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.