I am trying to use the Kubernetes Python client to perform a pod proxy get request using connect_get_namespaced_pod_proxy()
. If I curl the desired endpoint using port forwarding from the command line the request looks something like this:
curl -u <USER>:<PW> -X GET http://<HOST>:<PORT>/<PATH>
Trying to replicate this with the Python client I do something like this:
from Kubernetes import client,config
POD_NAME = "<pod_name>"
PORT = "<port>"
NAMESPACE = "<namesapce>"
PATH = "<path_to_endpoint>"
config.load_kube_config()
c = client.CoreV1Api()
resp = c.connect_get_namespaced_pod_proxy(POD_NAME + ":" + PORT, NAMESPACE, PATH)
However this fails (returns 401 Unauthorized) because I'm not passing the user/pw with the request.
Is it possible to pass these credentials in some way with this request? FWIW the creds are stored in a field on a configmap in the namespace.