derailed / k9s

🐶 Kubernetes CLI To Manage Your Clusters In Style!
https://k9scli.io
Apache License 2.0
25.92k stars 1.62k forks source link

Proxy support #825

Open rocketraman opened 4 years ago

rocketraman commented 4 years ago




Is your feature request related to a problem? Please describe. Some clusters require proxies in order to access their APIs. Most notably, GKE clusters with private networking. When using kubectl, one can work around this by setting the https_proxy variable for specific commands. However, with k9s I don't see any way to connect to a cluster via a proxy (edit, per a comment in #371 the slightly non-standard uppercase HTTPS_PROXY does work).

However, the https_proxy / HTTPS_PROXY env var for k9s is not ideal as different clusters often need different proxies, and this approach does not allow switching contexts that need a different proxy (or no proxy) without restarting k9s with the appropriate environment.

Describe the solution you'd like I'd love a way to configure a proxy on a per-context basis. Lens supports this, for example.

Describe alternatives you've considered I don't have any alternatives.

Additional context Kubectl 1.19+ has the ability to configure proxies via kube config: https://github.com/kubernetes/client-go/issues/351. Its likely any solution in k9s should first use this setting, and only fall-back to a k9s-native proxy configuration mechanism.

xens commented 2 years ago

Looks like that this is now working out-of-the-box, tested on v0.24.15.

MichaelHindley commented 1 year ago

After updating to v0.26.3 from v0.25.*, the proxy functionality seems broken, when choosing a cluster to connect to results in "Unable to connect to context". kubectl commands in the same terminal work fine, and v0.25 works fine too.

edit: this is for proxy set using HTTPS/HTTP_PROXY.

thewilli commented 1 year ago

Should we create a dedicated issue to support the proxy-url field in a kubeconfig instead?

It seems to solve this issue but is more explicit regarding the actual steps required.

nrekretep commented 1 year ago

I am having this problem, too.

kubectl works just fine with the proxy settings (via env vars) in the same terminal. Any chances that this will get fixed soon?

Thank you!

CJCShadowsan commented 11 months ago

I'll add a "me too" to this - Defining in a kubeconfig works fine, k9s? Nope.

If I run the command with HTTPS_PROXY defined to a socks5 proxy, that works - But it would be good for k9s to support the same kubeconfig mechanism that kubectl does, i.e. proxy-url

BlackDex commented 5 months ago

Not sure what the status of this issue is. But socks5:// seems to work indeed. Only socks5h:// isn't. The h means sending dns requests also via the socks5 proxy.

placintaalexandru commented 3 months ago

Hello,

I'll try to work on this one. I looked at the code and so far I can make k9s to interact with a basic http proxy I hardcoded.