Skip to content

ERR_TLS_CERT_ALTNAME_INVALID for socks-proxy-agent #365

@warjiang

Description

@warjiang

Background

I found that the client-node sdk(you can treat the sdk as another client-go sdk implementation for node), if there is a proxy-url in the kubeconfig file, client-node sdk will create agent for proxy request to kubernetes apiserver.

Problems

The feature seems not work for me, code snippet as following:

import * as k8s from '@kubernetes/client-node';


const kc = new k8s.KubeConfig();
kc.loadFromFile('path/to/local/kubeconfig')
const k8sApi = kc.makeApiClient(k8s.CoreV1Api);
k8sApi.listNamespacedPod({ namespace: "default" }).then((res) => {
  console.log(res);
});

error occured:
Image

the root cause for the error is that, when invoke the tls.connect, the proxy-agents sdk will ignore the host information:

const tlsSocket = tls.connect({
...omit(
setServernameFromNonIpHost(opts),
'host',
'path',
'port'
),
socket,
});

And I try to add host field by removing the host field from omit list, like following:
Image

It seems it works, so any explantation about omitting host field, and should we avoidding omit host field? @TooTallNate

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions