Kubernetes GCE Configuration Error using client python

7/20/2017

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.

-- kt14
google-kubernetes-engine
kubernetes
python-3.x

1 Answer

7/23/2017

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.

-- Mehdy
Source: StackOverflow