-
Notifications
You must be signed in to change notification settings - Fork 552
Description
Describe the bug
I metioned that in the client-node sdk main branch, it implemented proxy-url feature, it would be very useful for local development. But when I use the client-node sdk, and the kubeconfig file contains proxy-url field, it will output the following error:
Client Version
e.g. 0.12.0
not a stable release version, just in the main branch.
Server Version
e.g. 1.19.1
v1.28.3
To Reproduce
Steps to reproduce the behavior:
prepare a kubeconfig file with proxy-url, and use the loadFromFile
method to init the client-node sdk.
Expected behavior
A clear and concise description of what you expected to happen.
I expected the sdk can work with the proxy-url, and visit the kubernetes apiserver.
Example Code
Code snippet for what you are doing
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);
});
Environment (please complete the following information):
- OS: [e.g. Windows, Linux] macos
- Node.js version [eg. 20] v20.12.1
- Cloud runtime [e.g. Azure Functions, Lambda] local devel
Additional context
Add any other context about the problem here.
I try to solve the problem by diving into the source code. Here is some analysis for the problem: TooTallNate/proxy-agents#365, maybe it will help the community team to solve the problem~
Activity
brendandburns commentedon Feb 22, 2025
It appears that you are connecting to 'localhost' as the API server, but that is not in the subject names that are in the certificate (as expected).
What is the
server
set to in your kubeconfig?warjiang commentedon Feb 23, 2025
yes, the problem is setting wrong host, which caused by
socks-proxy-agent
package, it will omit thehost
when create tls connection.and the server in my kubeconfig is that:

BTW I have tested the same kubeconfig with
client-go
sdk, it works~.warjiang commentedon Feb 23, 2025
It seems not the problem of invoking, when send request to apiserver, the request lib(aka node-fetch) will set host according to server field in the kubeconfig:
the opts param passed in the connect method in socks-proxy-agent is still right:

here the invoke to apiserver is tls request, so it will create the tls socket based on socks5 socket, but it will ignore host which generated by node-fetch lib:

so the duo tls verify will be failed.
brendandburns commentedon Feb 25, 2025
It seems like this is a bug in the
socks-proxy-agent
library?warjiang commentedon Feb 27, 2025
Yes, i'm trying to prepare more snippet to prove that. BTW, is anyone tested the
proxy-url
feature? I want to make sure that is it a common problem ?warjiang commentedon Mar 2, 2025
@brendandburns already confirm the problem, it seems that
socks-proxy-agent
doesn't take bilateral tls verification into consideraion(because I've tested the http/https version, it doesn't works for scenario of bilateral tls verification)warjiang commentedon Mar 10, 2025
it seems that the upstream of
socks-proxy-agent
no reply recently, should we maintain another copy ofsocks-proxy-agent
in thekubernetes-client/javascript
source code, it doesn't cost much, and will be easy to maintain, just inherit the base class and use the socket javascript lib directly. @brendandburnsk8s-triage-robot commentedon Jun 8, 2025
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied,lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle stale
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
warjiang commentedon Jun 8, 2025
the issuse is pending due to no response from upstream. It seems that the
socks-proxy-agent
library is not under maintain any more ?k8s-triage-robot commentedon Jul 8, 2025
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied,lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle rotten
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten