from kubernetes import client, config
config.load_kube_config()
v1 = client.CoreV1Api()
print("Listing pods with their IPs:")
ret = v1.list_pod_for_all_namespaces(watch=False)
for i in ret.items:
print("%s\t%s\t%s" % (i.status.pod_ip, i.metadata.namespace, i.metadata.name))
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='192.168.0.1', port=6443): Max retries exceeded with url: /api/v1/pods?watch=False (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)'),))
this problem caused by urllib3 with ssl,
modify python3.6/site-packages/kubernetes/client/configuration.py:
self.verify_ssl = True ---> False
enjoy!
OK, thx.
Could you explain why is not working setting the property in the code ?
k8s=client.CoreV1Api()
k8s.api_client.configuration.verify_ssl = False
I am also getting this error in 2.7
MaxRetryError: HTTPSConnectionPool(host='myhost', port=443): Max retries exceeded with url: /api/v1/namespaces/dsmc-monitoring/events (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)'),))
despite using the "official" requirements from:
https://github.com/kubernetes-client/python/blob/release-6.0/requirements.txt
I have the same issue. @vmulex 's workaround works for me. But it is not the recommended way obviously. Any other suggestions?
Thanks anyway.
This is an unacceptable workaround tbh. Can we have this issue reopened.
The way you are configuring is not correct. Here is a sample which is working:
from kubernetes import client, config
# Configs can be set in Configuration class directly or using helper utility
config.load_kube_config()
# Create a configuration object
aConfiguration = client.Configuration()
aConfiguration.verify_ssl = False
api_client = client.ApiClient(aConfiguration)
v1 = client.CoreV1Api(api_client)
print("Listing pods with their IPs:")
ret = v1.list_pod_for_all_namespaces(watch=False)
for i in ret.items:
print("%s\t%s\t%s" % (i.status.pod_ip, i.metadata.namespace, i.metadata.name))
Most helpful comment
The way you are configuring is not correct. Here is a sample which is working: