Proxy 在kubernetes前面添加身份验证代理

Proxy 在kubernetes前面添加身份验证代理,proxy,kubernetes,kubectl,Proxy,Kubernetes,Kubectl,我在KubernetesAPI前面添加了一个代理,以便使用自制的身份验证系统对用户进行身份验证(以及其他操作) 我已经修改了kube配置,让kubectl点击代理。代理有自己的kubeconfig和有效的证书颁发机构数据,因此我不需要任何凭据 到目前为止,这工作正常,以下是我在本地需要的最低配置: clusters: - cluster: server: http://localhost:8080 name: proxy contexts: - context: clust

我在KubernetesAPI前面添加了一个代理,以便使用自制的身份验证系统对用户进行身份验证(以及其他操作)

我已经修改了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
或者指定身份验证提供程序,例如

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://...

令牌凭据仅通过TLS安全连接发送。服务器必须是https://...