I am trying to use Kubernetes python SDK.
I tried to run the following code:
from kubernetes import client, config
# Configs can be set in Configuration class directly or using helper utility
config.load_kube_config()
v1 = client.CoreV1Api()
print("Listing pods with their IPs:")
ret = v1.list_pod_for_all_namespaces(watch=False)
It failed with lots of errors.
When I run the same code with python from a shell, the same issue.
When I run the same code with sudo python
from shell, it works.
I am trying to run PyCharm interperte as root.
Following the instruction from JetBrains, I created a script shell with the name pythonCustomInt.sh
that contains:
sudo python
I went to PyCharm settings > Project Interpreter and changed the Base interpreter
to /<path>/pythonCutomInt.sh
but it writes an error:
Environment location directory is not empty
I ran sudo -s
and then from the pycharm folder (pycharm-community-2018.1.4/bin
) I ran sh ./pycharm.sh
and it worked.