Local_Proxy_for_Development_
Local Proxy for Development
When developing an application or service, one quick way to check your service is to run a local proxy with kubectl
. It will capture the shell, unless you place it in the background. When running, you can make calls to the Kubernetes API on localhost and also reach the ClusterIP
services on their API URL. The IP and port where the proxy listens can be configured with command arguments.
Run a proxy:
$ kubectl proxy
Starting to serve on 127.0.0.1:8001
Next, to access a ghost
service using the local proxy, we could use the following URL, for example, at http://localhost:8001/api/v1/namespaces/default/services/ghost.
If the service port has a name, the path will be http://localhost:8001/api/v1/namespaces/default/services/ghost:<port_name>
.