<p>My purpose is to access my k8s API from a remote server using python client and client certificate, which is working with curl like this:</p>

<p><code>curl --key /XXX/XXX.key --cert /XXX/XXX.crt --cacert /XXX/XXX.crt  https://api-k8s.XXX-XXX.XXX-XXX-/api/v1/pods</code></p>

<p>My code is:</p>

<pre><code>
configuration = client.Configuration()

configuration.host = 'https://api-XXXX'
configuration.ssl_ca_cert = '/XXX/xxx.crt'
configuration.cert_file = '/XXX/xxx.crt'
configuration.key_file = '/XXX/xxx.key'
configuration.verify_ssl = True

v1 = client.CoreV1Api(client.ApiClient(configuration))

ret = v1.list_pod_for_all_namespaces()
</code></pre>

<p>but getting:</p>

<pre><code>urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='XXX', port=443): Max retries exceeded with url: /api/v1/pods (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:618)'),))
</code></pre>

<p>If you have any ideas what I am missing would be greatly appreciated!</p>

Georgios
<p>I just reproduced your scenario, and it works perfectly on python 2.7</p>

<p>This is the code:</p>

<pre><code>from kubernetes import client

configuration = client.Configuration()

configuration.host = 'https://10.132.0.25:6443'
configuration.ssl_ca_cert = './ca.crt'
configuration.cert_file = './client.crt'
configuration.key_file = './client.key'
configuration.verify_ssl = True

v1 = client.CoreV1Api(client.ApiClient(configuration))

ret = v1.list_pod_for_all_namespaces()

for i in ret.items:
  print("%s\t%s\t%s" % (i.status.pod_ip, i.metadata.namespace, i.metadata.name))
</code></pre>

<p>...and the result:</p>

<pre><code>$ python test.py 
192.168.171.66  kube-system     calico-kube-controllers-65b8787765-h7qv7
10.132.0.25     kube-system     calico-node-t4r4v
10.132.0.26     kube-system     calico-node-zbtjm
192.168.171.65  kube-system     coredns-5c98db65d4-rm2qh
192.168.171.67  kube-system     coredns-5c98db65d4-sr67s
10.132.0.25     kube-system     etcd-master
10.132.0.25     kube-system     kube-apiserver-master
10.132.0.25     kube-system     kube-controller-manager-master
10.132.0.26     kube-system     kube-proxy-759gn
10.132.0.25     kube-system     kube-proxy-v5hvc
10.132.0.25     kube-system     kube-scheduler-master
</code></pre>

<p>I created the cluster with kubeadm. It is running 1.15.3</p>

<pre><code>$ kubectl get no
NAME     STATUS   ROLES    AGE   VERSION
master   Ready    master   41m   v1.15.3
worker   Ready    worker   41m   v1.15.3
</code></pre>

<p>Finally, client libraries:</p>

<pre><code>$ pip freeze | grep -E 'kubernetes|requests'
kubernetes==10.0.1
requests==2.22.0
</code></pre>

<p>To troubleshoot more, more information is needed; regarding versions especially. But your code works fine.</p>

<p><strong>EDIT:</strong> It worked on python3 as well:</p>

<pre><code>$ python3 test.py 
192.168.171.66  kube-system     calico-kube-controllers-65b8787765-h7qv7
10.132.0.25     kube-system     calico-node-t4r4v
10.132.0.26     kube-system     calico-node-zbtjm
192.168.171.65  kube-system     coredns-5c98db65d4-rm2qh
192.168.171.67  kube-system     coredns-5c98db65d4-sr67s
10.132.0.25     kube-system     etcd-master
10.132.0.25     kube-system     kube-apiserver-master
10.132.0.25     kube-system     kube-controller-manager-master
10.132.0.26     kube-system     kube-proxy-759gn
10.132.0.25     kube-system     kube-proxy-v5hvc
10.132.0.25     kube-system     kube-scheduler-master
</code></pre>
