-
Dear kube-rs team, I am learning using your library and rust and I need to access my kubectl through a socks5 proxy. I copied the ~/.kube/config file from remote machine to local and run this
and this is my code
My application hangs when trying to get the list of jobs because it is not using the socks5 proxy
Version
Could you please let me know what am I doing wrong? thank you |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Proxies are not supported out of the box at the moment. I was experimenting with it a while ago, but haven't had the time to finish (#837). For SOCKS5, you should be able to do something like this with a custom client with let mut config = Config::infer().await?;
let connector = {
let mut http = HttpConnector::new();
http.enforce_http(false);
let proxy = hyper_socks2::SocksConnector {
proxy_addr: Uri::from_static("socks5://localhost:5000"),
auth: None,
connector: http,
};
let tls = tokio_native_tls::TlsConnector::from(config.native_tls_connector()?);
hyper_tls::HttpsConnector::from((proxy, tls))
};
let service = ServiceBuilder::new()
.layer(config.base_uri_layer())
.service(hyper::Client::builder().build(connector));
let client = Client::new(service, config.default_namespace); This was working back in February. For http(s) proxy, I'm hoping Once we figure these out, the default client needs to be updated to use proxies if configured. |
Beta Was this translation helpful? Give feedback.
-
thx @kazk I got something working like the following:
|
Beta Was this translation helpful? Give feedback.
Proxies are not supported out of the box at the moment. I was experimenting with it a while ago, but haven't had the time to finish (#837).
For SOCKS5, you should be able to do something like this with a custom client with
hyper-socks2
: