Using Kubectl Proxy

This topic describes how to setup a kubectl proxy for an a9s Kubernetes instance.

Creating the Proxy

After configuring your kubeconfig file to access your a9s Kubernetes instance, you can create a proxy as follow:

$ kubectl proxy --port=8080 --accept-hosts=".*"

Traffic to the Kubernetes API goes through the a9s Router component, where the request is forwarded to the correct host according to the URL target. Because the a9s Router uses the target host to forward the request using the appropriate backend, it is necessary to use the --accept-hosts parameter. This way, the Host header is accepted by the proxy as the target when access using curl or other tools.

Accessing Via Proxy

On your curl command, you must specify the Host header:

$ curl --header "Host: <external-route-hostname>" localhost:8080/api

E.g:

$ curl --header "Host: api-09e0cf69-8aea-406d-9920-e83f11be2716.k8s-dsf2.a9s-ds-concourse.a9s-ops.de" \
  localhost:8080/api