Skip to content

Client not able to reach Cluster API behind a proxy if using multiple client function #1967

@FlorianJDF

Description

@FlorianJDF

Hello all,

What happened (please include outputs or screenshots):
I need to access multiple k8s clusters at once, all behind a proxy.
To be able to reach many k8s clusters at once, I use the function new_client_from_config_dict.

Unfortunatly this do no allow to have an HTTP(S) PROXY set.

This #333 solution do not work because the new_client_from_config_dict is not using the _default object in kube_client.Configuration

What you expected to happen:
Been able to set a proxy variable or inject a client configuration when using the function new_client_from_config_dict

How to reproduce it (as minimally and precisely as possible):

# This is working
config.load_kube_config()
client.Configuration._default.proxy = "MY_HTTP_PROXY"
client.CoreV1Api().list_namespace()
# Impossible to set a proxy with a new client from config
my_client = config.new_client_from_config_dict(kubeconfig2)
my_client.configuration.proxy = "MY_HTTP_PROXY"
client.CoreV1Api(api_client=my_client).list_namespace()
# >> Proxy error

Environment:

  • Kubernetes version (kubectl version):
  • 1.23.8

  • OS (e.g., MacOS 10.13.6):
  • MacOS 13.0.1

  • Python version (python --version)
  • 3.9.13

  • Python client version (pip list | grep kubernetes)
  • 25.3.0

Thanks,

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions