[英]Adding authentication proxy in front of kubernetes
我在kubernetes API之前添加了一个代理,以便使用自制的身份验证系统对用户进行身份验证(以及其他操作)。
我已经修改了kube配置,使kubectl达到了代理。 代理具有自己的kubeconfig以及有效的证书颁发机构数据,因此我不需要任何凭证。
到目前为止,一切正常,这是我在本地需要的最低配置:
clusters:
- cluster:
server: http://localhost:8080
name: proxy
contexts:
- context:
cluster: proxy
name: proxy
current-context: proxy
现在,身份验证应该基于令牌,我希望我能够将其作为kubectl请求标头的一部分进行传递。
我尝试了多种配置,在kubeconfig中添加了一个带有令牌的用户,例如
clusters:
- cluster:
server: http://localhost:8080
name: proxy
contexts:
- context:
cluster: proxy
user: robin
name: proxy
current-context: proxy
users:
- name: robin
user:
token: my-token
或指定一个auth-provider,例如
clusters:
- cluster:
server: http://localhost:8080
name: proxy
contexts:
- context:
cluster: proxy
user: robin
name: proxy
current-context: proxy
users:
- name: robin
user:
auth-provider:
config:
access-token: my-token
我什至尝试不使用任何用户,只是将令牌添加为首选项的一部分,因为我想要的只是在标题中包含令牌
clusters:
- cluster:
server: http://localhost:8080
name: proxy
contexts:
- context:
cluster: proxy
name: proxy
current-context: proxy
preferences:
token: my-token
但是我从来没有看到我的令牌作为代理端的请求标头的一部分。 倾销请求,我得到的只是:
GET /api/v1/namespaces/default/pods?limit=500 HTTP/1.1
Host: localhost:8080
Accept: application/json;as=Table;v=v1beta1;g=meta.k8s.io, application/json
Accept-Encoding: gzip
User-Agent: kubectl/v1.11.0 (darwin/amd64) kubernetes/91e7b4f
我显然在这里丢失了一些东西,kubectl如何不能在其标头中传递用户信息? 假设我没有代理,“ kubectl-> kubernetes”令牌身份验证如何工作?
如果有人在kubernetes和客户端之间添加这种身份验证层有任何经验,我可以使用一些帮助:)
令牌凭证仅通过TLS保护的连接发送。 服务器必须为https:// ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.