Skip to content

SSL hostname verification failure with websocket-client #138

@vedujoshi

Description

@vedujoshi

I have this simple script. Even though authentication does work, call to connect_get_namespaced_pod_exec() fails .

The list of installed pip pkgs installed is in https://gist.github.com/vedujoshi/07a79b6d1ea38701a2993fab63f55cfd

root@fb2337702e18:/# cat test1.py
from kubernetes import client, config
config.load_kube_config(config_file='admin2.conf')
v1 = client.CoreV1Api()
pod_list = v1.list_namespaced_pod("kube-system")
for pod in pod_list.items:
print pod.metadata.name

name = 'kube-discovery-1769846148-bsqt0'
namespace = 'kube-system'
command = 'ls'
stderr = False
stdin = False
stdout = False
tty = False
api_response = v1.connect_get_namespaced_pod_exec(name, namespace, command=command, stderr=stderr, stdin=stdin, stdout=stdout, tty=tty)
print api_response
root@fb2337702e18:/# python test1.py
/usr/local/lib/python2.7/dist-packages/urllib3/util/ssl_.py:334: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/urllib3/util/ssl_.py:132: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecurePlatformWarning
dummy-2088944543-43k1b
etcd-testbed-1-vm1.englab.juniper.net.204.10.in-addr.arpa
kube-apiserver-testbed-1-vm1.englab.juniper.net.204.10.in-addr.arpa
kube-controller-manager-testbed-1-vm1.englab.juniper.net.204.10.in-addr.arpa
kube-discovery-1769846148-bsqt0
kube-dns-2924299975-7bcdb
kube-proxy-b7g0b
kube-scheduler-testbed-1-vm1.englab.juniper.net.204.10.in-addr.arpa
Traceback (most recent call last):
File "test1.py", line 15, in
api_response = v1.connect_get_namespaced_pod_exec(name, namespace, command=command, stderr=stderr, stdin=stdin, stdout=stdout, tty=tty)
File "/usr/local/lib/python2.7/dist-packages/kubernetes/client/apis/core_v1_api.py", line 907, in connect_get_namespaced_pod_exec
(data) = self.connect_get_namespaced_pod_exec_with_http_info(name, namespace, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/kubernetes/client/apis/core_v1_api.py", line 1012, in connect_get_namespaced_pod_exec_with_http_info
collection_formats=collection_formats)
File "/usr/local/lib/python2.7/dist-packages/kubernetes/client/api_client.py", line 329, in call_api
_return_http_data_only, collection_formats, _preload_content, _request_timeout)
File "/usr/local/lib/python2.7/dist-packages/kubernetes/client/api_client.py", line 153, in __call_api
_request_timeout=_request_timeout)
File "/usr/local/lib/python2.7/dist-packages/kubernetes/client/api_client.py", line 355, in request
headers=headers)
File "/usr/local/lib/python2.7/dist-packages/kubernetes/client/ws_client.py", line 237, in websocket_call
raise ApiException(status=0, reason=str(e))
kubernetes.client.rest.ApiException: (0)
Reason: hostname '10.204.217.194' doesn't match either of 'kubernetes', 'kubernetes.default', 'kubernetes.default.svc', 'kubernetes.default.svc.cluster.local'

root@fb2337702e18:/#

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions