kubenetworks / kubevpn

KubeVPN offers a Cloud Native Dev Environment that connects to kubernetes cluster network.
https://www.kubevpn.cn
MIT License
557 stars 45 forks source link

指定header的反向代理不生效 #320

Closed A11Might closed 2 months ago

A11Might commented 2 months ago

执行命令kubevpn proxy deployment/xx-test -n xx-dev --image registry.cn-hangzhou.aliyuncs.com/xx/kubevpn:v2.2.17,可以正常使用本地机器代理节点流量。但执行命令kubevpn proxy deployment/xx-test -n xx-dev --image registry.cn-hangzhou.aliyuncs.com/xx/kubevpn:v2.2.17 --headers user=naison,加不加header都无法正常进行请求。应该如何排查这个问题?

A11Might commented 2 months ago

命令执行都成功返回:Now you can access resources in the kubernetes cluster, enjoy it :)

wencaiwulue commented 2 months ago

@A11Might 使用 kubevpn list 看看状态尼?使用了 proxy 么有带header后,需要 kubevpn leave ,然后再 proxy 带header哈

A11Might commented 2 months ago

@A11Might 使用 kubevpn list 看看状态尼?使用了 proxy 么有带header后,需要 kubevpn leave ,然后再 proxy 带header哈

尝试了下还是不行,kubevpn list执行结果

- Ports: null
  Rules:
  - Headers:
      a: "1"
    LocalTunIPv4: 223.254.0.124
    LocalTunIPv6: efff:ffff:ffff:ffff:ffff:ffff:ffff:99b1
    PortMap: {}
  Uid: deployments.apps/xx-test 
wencaiwulue commented 2 months ago

@A11Might 使用 kubevpn list 看看状态尼?使用了 proxy 么有带header后,需要 kubevpn leave ,然后再 proxy 带header哈

尝试了下还是不行,kubevpn list执行结果

- Ports: null
  Rules:
  - Headers:
      a: "1"
    LocalTunIPv4: 223.254.0.124
    LocalTunIPv6: efff:ffff:ffff:ffff:ffff:ffff:ffff:99b1
    PortMap: {}
  Uid: deployments.apps/xx-test 

因为你这里的 port是空的,你可以edit 一下 deployment,然后 containerPort 加一下端口就好啦。

A11Might commented 2 months ago

@A11Might 使用 kubevpn list 看看状态尼?使用了 proxy 么有带header后,需要 kubevpn leave ,然后再 proxy 带header哈

尝试了下还是不行,kubevpn list执行结果

- Ports: null
  Rules:
  - Headers:
      a: "1"
    LocalTunIPv4: 223.254.0.124
    LocalTunIPv6: efff:ffff:ffff:ffff:ffff:ffff:ffff:99b1
    PortMap: {}
  Uid: deployments.apps/xx-test 

因为你这里的 port是空的,你可以edit 一下 deployment,然后 containerPort 加一下端口就好啦。

可以啦,感谢。非常好用

wencaiwulue commented 2 months ago

@A11Might 使用 kubevpn list 看看状态尼?使用了 proxy 么有带header后,需要 kubevpn leave ,然后再 proxy 带header哈

尝试了下还是不行,kubevpn list执行结果

- Ports: null
  Rules:
  - Headers:
      a: "1"
    LocalTunIPv4: 223.254.0.124
    LocalTunIPv6: efff:ffff:ffff:ffff:ffff:ffff:ffff:99b1
    PortMap: {}
  Uid: deployments.apps/xx-test 

因为你这里的 port是空的,你可以edit 一下 deployment,然后 containerPort 加一下端口就好啦。

可以啦,感谢。非常好用

好用的话,帮我推荐给同事也用用哈,欢迎提代码或者提bug ~