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

Using no_proxy attribute does not work as expected #1995

Closed
jandbg opened this issue Jan 25, 2023 · 7 comments
Closed

Using no_proxy attribute does not work as expected #1995

jandbg opened this issue Jan 25, 2023 · 7 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@jandbg
Copy link

jandbg commented Jan 25, 2023

Hi all! First I would like to said thanks for the this k8s client library, I think it´s a great tool! We use it a lot in our projects.
We are facing the following issue. We have a pod (lets said pod A) where we´re running a program based on:
https://github.com/kubernetes-client/python/blob/master/examples/pod_exec.py

The goal of the pogram is to execute a command in another pod, lets said pod B.

In the pod A we have defined an HTTPS_PROXY environment variable, and we would like to bypass this HTTPS_PROXY, so we set the atributte no_proxy on the kubernetes.client.Configuration class. We are not very sure how to use this attribute, we set no_proxy attribute with the pod B´s IP address but we still get the "Error 407 Proxy authentication". So I guess we couldn´t bypass the proxy.

The question is, how I should proceed to execute the command in the pod B and bypass the HTTPS_PROXY? How I must setup the no_proxy attribute? I mean, I guess is a IPs string comma separated, I´m right? Something like this "100.67.5.3.170,100.65.2.169"

Thank you very much in advance, best regards!

Environment:

  • Kubernetes Version: v1.23.12+8a6bfe4
  • PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
    NAME="Debian GNU/Linux"
    VERSION_ID="11"
    VERSION="11 (bullseye)"
    VERSION_CODENAME=bullseye
    ID=debian
  • Python 3.8.16
  • Python client version (pip list | grep kubernetes): kubernetes 24.2.0
@jandbg jandbg added the kind/bug Categorizes issue or PR as related to a bug. label Jan 25, 2023
@roycaihw
Copy link
Member

this PR could be related #1968

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 30, 2023
@jandbg
Copy link
Author

jandbg commented May 12, 2023 via email

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jun 11, 2023
@jandbg jandbg closed this as completed Jun 11, 2023
@jandbg
Copy link
Author

jandbg commented Jun 11, 2023

Finally we set the environment variable with os.environ before the call Configuration().get_default_copy(), because neither no_proxy nor NO_PROXY work as expected.
We really appreciate you efforts with this library. Thanks!

@gurujonnala
Copy link

Dear @jandbg we ran in to the same problem as you did. We aren't able to bypass the proxy when executing a command from within the POD using the connect_get_namespaced_pod_exec method. We use API Key and Username, but not kubeconfig. We have set os.environ['NO_PROXY'] and ['no_proxy'] both, but without any avail. Could you let me know what worked for you in this case? Thanks..

@jandbg
Copy link
Author

jandbg commented Sep 4, 2023

Hi @gurujonnala , we solved the problem setting the following environment variable

os.environ['HTTPS_PROXY'] = '' # c.no_proxy does not work

before we created the Configuration().get_default_copy() object and call exec_commands function.
I hope this help you. Regards!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

5 participants