'Kubelet may or may not accept un-authenticated http requests.
If it doesn\'t we need to use its HTTPS API that may or may not
require auth.'

def _locate_kubelet(self, instance):

    host = (os.environ.get('KUBERNETES_KUBELET_HOST') or instance.get('host'))
    if (not host):
        docker_hostname = self.docker_util.get_hostname(should_resolve=True)
        if self.tls_settings.get('kubelet_verify'):
            try:
                k8s_hostname = self.get_node_hostname(docker_hostname)
                host = (k8s_hostname or docker_hostname)
            except Exception as ex:
                log.error(str(ex))
                host = docker_hostname
        else:
            host = docker_hostname
    try:
        port = instance.get('kubelet_port', KubeUtil.DEFAULT_HTTP_KUBELET_PORT)
        no_auth_url = ('http://%s:%s' % (host, port))
        test_url = urljoin(no_auth_url, KubeUtil.KUBELET_HEALTH_PATH)
        self.perform_kubelet_query(test_url)
        return no_auth_url
    except Exception:
        log.debug("Couldn't    query    kubelet    over    HTTP,    assuming    it's    not    in    no_auth    mode.")
    port = instance.get('kubelet_port', KubeUtil.DEFAULT_HTTPS_KUBELET_PORT)
    https_url = ('https://%s:%s' % (host, port))
    test_url = urljoin(https_url, KubeUtil.KUBELET_HEALTH_PATH)
    self.perform_kubelet_query(test_url)
    return https_url
