How to send token within url in Kubernetes?

5/30/2016

I want to use websocket to access Kubernetes API, and so it is more convenient to send token like wss://example.com" + url + "&access_token=blahblahblah. The official API doc sends token in header. Where can I find such a token and send it with url?

What I want to do is to exec pods via a web page through websocket:

Container-Terminal via Websocket

Support exec and pod logging over WebSockets

-- Haoyuan Ge
kubernetes
websocket

2 Answers

5/31/2016

After searching over the Internet and reading many discussion on Kubernetes, I post my own answer about accessing kubernetes API with password in url, not header:

wss://username:myPassword@Address.To.Kubernetes/api/v1/namespaces/default/pods/YourPodName/exec?stdout=1&stdin=1&stderr=1&tty=1&command=%2Fbin%2Fsh

The username and password is in ~/.kube/config

Welcome answers for sending bearer token.

-- Haoyuan Ge
Source: StackOverflow

6/2/2016

Bearer token authentication in the URL is not supported in Kubernetes currently, only as an Authorization header.

-- Jordan Liggitt
Source: StackOverflow