-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Document how to use this with kubectl proxy
#303
Comments
This should work: from kubernetes.client import configuration
configuration.host = "127.0.0.1:8001"
# no need to call config.load_kube_config() If you want a client with this config but don't want to change global config: from kubernetes import client
from kubernetes.client import Configuration, ApiClient
myconfig=Configuration()
myconfig.host = "127.0.0.1:8001"
myapiclient = ApiClient(config=myconfig)
v1 = client.CoreV1Api(api_client=myapiclient)
# no need to call config.load_kube_config() Note: 127.0.0.1:8001 is what |
Thank you, this is useful. Is the singleton Configuration object still recommended or should I switch to using this instead in all my code? |
It is completely depends on your application. Singleton is for ease of use when you only talk to one cluster. If you want to connect to multiple clusters concurrently then you need to follow the second example. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
I've been profiling an application that talks heavily to the k8s API. A big performance bottleneck is doing TLS in python. It'd be great if instead I can run a kubectl proxy as a sidecar, and direct requests to there. That way, the go proxy deals with TLS (and is much faster)!
I'm not entirely sure how to construct a Configuration object that'll work for this tho. kubectl proxy by default provides an unauthenticated http port..
The text was updated successfully, but these errors were encountered: