javascript
javascript copied to clipboard
proxy-url in kube config not used
Cluster config in kube config allows proxy-url
setting (i.e. proxy-url: http://127.0.1.1:8080) but is not used in the js lib
** Client Version **
e.g. 0.13.6
** Server Version ** doesn't apply
To Reproduce Running the example from the main README.md with the current context pointing to a cluster that is configured with proxy-url, the example with throw "connect EHOSTUNREACH" when the cluster IP is not directly accessible.
Running the example with the env var HTTP_PROXY
works as expected
Expected behavior The clientlib should respect the proxy-url setting
** Example Code**
const k8s = require('@kubernetes/client-node');
const kc = new k8s.KubeConfig();
kc.loadFromDefault();
const k8sApi = kc.makeApiClient(k8s.CoreV1Api);
k8sApi.listNamespacedPod('default').then((res) => {
console.log(res.body);
}).catch(console.error);
Environment (please complete the following information):
- OS: Linux
- NodeJS Version 12.10.0
Relevant pointers:
- https://github.com/kubernetes/client-go/issues/351
- https://github.com/kubernetes/kubernetes/pull/81443
- https://github.com/kubernetes/kubernetes/blob/f02682c628c530219966a00ae002d799f0d813dc/staging/src/k8s.io/client-go/rest/config.go#L137-L139
This really points out the need for a clean spec for the kubeconfig file, since this never went through a KEP or anything else and just merged.
I'm happy to take a PR to add support for this, otherwise, we will get to it eventually.
Full implementation, obviously, is going to take time. Is that possible to start applying some fixes related to this issue? For example, stop filtering 'proxy-url' property while loading cluster configuration from config here.
I would like to try to provide a PR for this.
Could someone recommend a way to set up a test environment for this?
Would it be correct to assume that if I have a Kubernetes cluster and do a kubectl proxy --port <number>
and set the proxy URL to http://127.0.01:<number>
in my kubeconfig that this is a valid way to test this?
Or do I need to set up a nginx reverse proxy for this?
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.
This bot triages PRs according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the PR is closed
You can:
- Mark this PR as fresh with
/remove-lifecycle stale
- Close this PR with
/close
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
Any update on this? I am running into the same issue
/remove-lifecycle stale
Any update on this issue?
please assign me this issue.
/assign
I am having an issue for kube test
and kube run docs
@brendandburns Help me out
I am having an issue for
kube test
andkube run docs
Hello Mybe You Can Try import { BsModalModule } from 'ng2-bs3-modal'; Mybe This Will Help
Any update on this issue? Hello, Mybe You Can Try This Multiple Solution Way 1.Export KubeConfig To Path Directory Yaml Or Way 2.Paste The Yaml to YourDirectory/.Kube/Config
Actually in most of the .ts files which have "/api" it showing the the problem Module `'"./api"' has no exported member 'V1Secret'.ts(2305)``
Hi Guys ! Until this is solved I did a simple hack to be able to use proxy-url. I've override the KubeConfig makeApiClient method to be able to override the "request" configuration. It's not super safe but runs
Here the code
const kc = new k8s.KubeConfig();
const originalMakeApiClient = kc.makeApiClient;
kc.makeApiClient = function(api) {
const client = originalMakeApiClient.call(kc, api);
client.interceptors.push(async (config) => {
config.proxy="http://host:port";
});
return client;
};