rancher-desktop: Kubernetes was unable to start: TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:"
When installing Rancher Desktop behind a proxy, the following error occurs when k3s starts.
Kubernetes was unable to start: TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:"
I am behind a proxy and have the HTTP_PROXY and HTTPS_PROXY variables set. The proxy used by my company is available over “http” only so both variables are set to something like “http://my-proxy-url”. I also have values set in the NO_PROXY variable for some internal domains. Does there need to be an additional entry in NO_PROXY for Kubernetes?
Screenshots

Setup (please complete the following information):
- OS: Windows 10 Enterprise 10.0.19042 Build 19042
- Rancher Desktop version 0.6.0-186-g0c32457
- Using nightly build due to this issue
- Kubernetes version: 1.21.5
Snippet from the background.log
Kubernetes was unable to start: TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:"
at new ClientRequest (_http_client.js:155:11)
at TunnelingAgent.request (http.js:50:10)
at TunnelingAgent.createSocket (C:\Users\myuser\AppData\Local\Programs\Rancher Desktop\resources\app.asar\node_modules\tunnel-agent\index.js:135:25)
at TunnelingAgent.createSecureSocket [as createSocket] (C:\Users\myuser\AppData\Local\Programs\Rancher Desktop\resources\app.asar\node_modules\tunnel-agent\index.js:200:41)
at TunnelingAgent.createConnection (C:\Users\myuser\AppData\Local\Programs\Rancher Desktop\resources\app.asar\node_modules\tunnel-agent\index.js:98:8)
at TunnelingAgent.addRequest (C:\Users\myuser\AppData\Local\Programs\Rancher Desktop\resources\app.asar\node_modules\tunnel-agent\index.js:92:8)
at new ClientRequest (_http_client.js:306:16)
at Object.request (https.js:313:10)
at Request.start (C:\Users\myuser\AppData\Local\Programs\Rancher Desktop\resources\app.asar\node_modules\request\request.js:751:32)
at Request.end (C:\Users\myuser\AppData\Local\Programs\Rancher Desktop\resources\app.asar\node_modules\request\request.js:1505:10) {
code: 'ERR_INVALID_PROTOCOL'
}
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 3
- Comments: 21 (5 by maintainers)
Hey, I got the same issue. Solved it for me by looking at the
.kube/configfor the cluster IP address and then adding it to theNO_PROXYenvironment variable.It was able to proceed and finish the installation process, but my
kubectlcommand keeps failing with binary not found like this:Not sure if you patch the proxy to make googleapis address to return something but if you try to access the resource URL the binary seems to not be found
I’m running on 1.0.0-beta.1
Is there any update on this issue , how to make k3s/k8s work in RD behind http_proxy ?
The core of the problem is the underlying process (electron app) is mismanaging the
HTTP(s)_PROXYenvironment variable by making HTTP calls to the proxy where upstream requires HTTPS and vice versa. We will try to set up an environment to reproduce this. Once it is reproduced we will have a better idea of tackling it.Below are the scenarios to consider when tackling this issue:
Nope hoping to get more folks to keep flagging area/proxy as a place to invest.
Note to further research a solution.
Hi, the Kubernetes API only works behind
https. So it rejects the connection from anhttpproxy because there’s no authentication. See https://github.com/kubernetes-client/javascript/issues/648 for a similar issue when communicating directly through the underlying@kubernetes/client-nodelibrary. And that issue references the library’s docs on configuring proxies at https://github.com/request/request/blob/master/README.md#proxies . You might find something there that will help.I don’t understand why you’re not also running an https proxy, but IMO finding a way around this sounds like an invitation to get a CVE, at best.
Just tried with the version 0.7.0 and get the same error.