openshift/openshift-restclient-python

getting error afterrunning docker run command

jainpratik163 opened this issue · 3 comments

getting below error while running docker run command " k8s_client = config.new_client_from_config()"
and also I have installed this with python3.6 as I got the message that "DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020"

File "/usr/local/lib/python3.6/site-packages/kubernetes/config/kube_config.py", line 569, in load_config
with open(path) as f:
IsADirectoryError: [Errno 21] Is a directory: '/root/.kube/config'

what does /root/.kube/config look like in the container? It should be a valid kubeconfig file, it looks like it's finding a directory instead. If you have a kubeconfig in a different place you can set the KUBECONFIG environment variable to point there instead.

Closing (though I'll still respond to follow up comments if you have more issues), this isn't really a bug with this project. If there's a real issue loading a valid kubeconfig that should be filed against kubernetes-client/python, though I think it's likely just an environmental issue.

Here are the kubernetes docs on the kubeconfig file: https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/

Generally the kubeconfig is created automatically when you log in to a kubernetes cluster, so if you can access the cluster on your host and not the docker container, it would likely be as simple as mounting in the kubeconfig file (like docker run -v ~/.kube/config:/root/.kube/config my_container)