0
votes

I have kubernetes 1.7.0 cluster that is running on Google Container Engine. I would like to connect to the cluster's kubernetes API using kubernetes client-python.

Is there any other way of configuring the ConfigurationObject in python client by using the credentials from .kube/config file.

I can access the kube proxy on local machine and access the cluster but I would like to connect it through python.

1
can you use kubectl from your local machine? - surajd
Yes I can use kubectl, like @Mehdy pointed it out it is an issues with api itself - kt14

1 Answers

1
votes

Basically

from kubernetes import config 
config.load_kube_config() 

should work (except it won't because of the bug in GKE, read on). It tries to load config from default locations. Look at the parameters of that function for any customization.

For GKE, there is a bug and a PR to fix it and the fix should be available in 3.0.0b1.