Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work with a proxy #44

Closed
magnusboman opened this issue May 19, 2023 · 4 comments · Fixed by #155
Closed

Does not work with a proxy #44

magnusboman opened this issue May 19, 2023 · 4 comments · Fixed by #155
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@magnusboman
Copy link

I need a proxy to get to our kubernetes environments.
The proxy is specified in kubeconfig but it seems krr aren't using it.
I also tried to set an http{s}_proxy env variable but that didn't work either.

Using krr v1.0.0.

@LeaveMyYard
Copy link
Contributor

Hey, @magnusboman

Could you share an example on how your proxy is configured in kubeconfig?

@magnusboman
Copy link
Author

@LeaveMyYard :

clusters:
    - cluster:
        certificate-authority-data: xxx
        proxy-url: http://admin:password@127.0.0.1:8118
        server: https://xxx
      name: name

@LeaveMyYard LeaveMyYard self-assigned this May 25, 2023
@LeaveMyYard LeaveMyYard added the bug Something isn't working label May 25, 2023
@LeaveMyYard
Copy link
Contributor

I think this issue need to be fixed by python kubernetes-client library:
kubernetes-client/python#1862
kubernetes-client/python#1863

Maybe there might be possibility to add some temporary monkey-patch fix, to check the config for that field and to manually set it, but I am not really sure if that's a good solution to implement on KRR side.
@magnusboman WDYT?

@LeaveMyYard LeaveMyYard added the help wanted Extra attention is needed label May 29, 2023
@magnusboman
Copy link
Author

Are we able to at least add "os" proxy support for now?

I've tested this code and it works,

from kubernetes import client, config
import os

config.load_kube_config()

proxy_url = os.getenv('HTTP_PROXY', None)
if proxy_url:
    client.Configuration._default.proxy = proxy_url

v1 = client.CoreV1Api()
print("Listing pods with their IPs:")
ret = v1.list_pod_for_all_namespaces(watch=False)
for i in ret.items:
    print("%s\t%s\t%s" % (i.status.pod_ip, i.metadata.namespace, i.metadata.name))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants