Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use kubectl even with proxy settings #4965

Closed
mohibkhan-nedian opened this issue Aug 3, 2019 · 11 comments
Closed

Unable to use kubectl even with proxy settings #4965

mohibkhan-nedian opened this issue Aug 3, 2019 · 11 comments
Labels
co/none-driver kind/support Categorizes issue or PR as a support question.

Comments

@mohibkhan-nedian
Copy link

mohibkhan-nedian commented Aug 3, 2019

I am trying to use minikube. I am behind a proxy so I followed this article https://github.com/kubernetes/minikube/blob/master/docs/http_proxy.md. However, even after setting both no_proxy and NO_PROXY and other env var as mentioned in article, i am still getting

sudo minikube start --vm-driver=none --cpus=4 --memory=8000
😄  minikube v1.2.0 on linux (amd64)
🔥  Creating none VM (CPUs=4, Memory=8000MB, Disk=20000MB) ...
🌐  Found network options:
    ▪ HTTP_PROXY=....
⚠️  You appear to be using a proxy, but your NO_PROXY environment does not include the minikube IP (ip). Please see https://github.com/kubernetes/minikube/blob/master/docs/http_proxy.md for more details

and then

$kubectl get nodes
Unable to connect to the server: Forbidden

I am using minikube using --vm-driver = none. Does this matter? Is there any workaround then in the above article?

@mohibkhan-nedian
Copy link
Author

mohibkhan-nedian commented Aug 3, 2019

Kubectl version output

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.1", GitCommit:"4485c6f18cee9a5d3c3b4e523bd27972b1b53892", GitTreeState:"clean", BuildDate:"2019-07-18T09:18:22Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
Unable to connect to the server: Forbidden

@afbjorklund
Copy link
Collaborator

Did you add 127.0.0.1 to no_proxy ?

@afbjorklund
Copy link
Collaborator

sudo minikube start --vm-driver=none --cpus=4 --memory=8000

We really should add a warning when using none with cpus/memory...

But at least in the new release it will show that they are not being used.

i.e. since you are running it on localhost, the current VM will be used

@mohibkhan-nedian
Copy link
Author

mohibkhan-nedian commented Aug 3, 2019

@afbjorklund Yes, 127.0.0.1 is there in the mentioned link. What is surprising is that even though I have set NO_PROXY env var, I get the message ⚠️ You appear to be using a proxy, but your NO_PROXY environment does not include the minikube IP (ip). Please see https://github.com/kubernetes/minikube/blob/master/docs/http_proxy.md for more details . Since I am using --vm-driver=none, my minikube ip is same as machine ip which is in my NO_PROXY list. Is this the cause of issue?

The reason I have to use -vm-driver=none is because I am using a remote linux machine, in which I cannot turn on Virtualization. The machine has 4 cores and 8 GB, but since minikube by default use 2 cores and 2 GB, I had to pass --cpus and --memory. Do you still think the flags wont be used?

@afbjorklund
Copy link
Collaborator

Right, forgot that we still use the default/public IP for the none driver (#4313)

Anyways, then your NO_PROXY should contain the same as $(minikube ip)

I couldn't see the variables in the command above ?

Normally you have to use sudo -E, to keep variables.

@mohibkhan-nedian
Copy link
Author

mohibkhan-nedian commented Aug 3, 2019

@afbjorklund Are you talking about the HTTP_PROXY, HTTPS_PROXY and NO_PROXY env vars? Well, latest minikube itself picks up HTTP_PROXY and HTTPS_PROXY env vars as I have observed from the output of minikube start,
minikube v1.2.0 on linux (amd64)

🔥  Creating none VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
🌐  Found network options:
    ▪ HTTP_PROXY=....
⚠️  You appear to be using a proxy, but your NO_PROXY environment does not include the minikube IP (10.99.96.131). Please see https://github.com/kubernetes/minikube/blob/master/docs/http_proxy.md for more details
    ▪ HTTPS_PROXY=....🐳  Configuring environment for Kubernetes v1.15.0 on Docker 19.03.1
    ▪ env HTTP_PROXY= ....
    ▪ env HTTPS_PROXY=...
    ▪ kubelet.resolv-conf=/run/systemd/resolve/resolv.conf
🚜  Pulling images ...
🚀  Launching Kubernetes ... 
🤹  Configuring local host environment ...

. Regarding NO_PROXY, I am confused because I have added my machine ip in NO_PROXY env var but still I get ⚠️ You appear to be using a proxy, but your NO_PROXY environment does not include the minikube IP (ip). Please see https://github.com/kubernetes/minikube/blob/master/docs/http_proxy.md for more details

@mohibkhan-nedian
Copy link
Author

mohibkhan-nedian commented Aug 3, 2019

@afbjorklund I get same output if i start with the command in the given link with the flags

sudo minikube start --vm-driver=none \ --docker-env HTTP_PROXY=$HTTP_PROXY \ --docker-env HTTPS_PROXY=$HTTPS_PROXY \ --docker-env NO_PROXY=$NO_PROXY

🔥  Creating none VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
🌐  Found network options:
    ▪ HTTP_PROXY=....
⚠️  You appear to be using a proxy, but your NO_PROXY environment does not include the minikube IP (10.99.96.131). Please see https://github.com/kubernetes/minikube/blob/master/docs/http_proxy.md for more details
    ▪ HTTPS_PROXY=....🐳  Configuring environment for Kubernetes v1.15.0 on Docker 19.03.1
    ▪ env HTTP_PROXY= ....
    ▪ env HTTPS_PROXY=...
    ▪ kubelet.resolv-conf=/run/systemd/resolve/resolv.conf
🚜  Pulling images ...
🚀  Launching Kubernetes ... 
🤹  Configuring local host environment ...

@afbjorklund afbjorklund added the kind/support Categorizes issue or PR as a support question. label Aug 4, 2019
@afbjorklund
Copy link
Collaborator

You seem to be passing HTTP_PROXY (through some global configuration), but not NO_PROXY ?

So do that, something like: sudo NO_PROXY=$NO_PROXY minikube start --vm-driver=none

@mohibkhan-nedian
Copy link
Author

@afbjorklund Thanks, now I am not getting the error about NO_PROXY on minikube start.

sudo NO_PROXY=$NO_PROXY minikube start --vm-driver=none
😄  minikube v1.2.0 on linux (amd64)
🔥  Creating none VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
🌐  Found network options:
    ▪ HTTP_PROXY=....
    ▪ HTTPS_PROXY=....
    ▪ NO_PROXY=localhost,127.0.0.1,10.96.0.0/12,192.168.99.0/24,192.168.39.0/24,myip
🐳  Configuring environment for Kubernetes v1.15.0 on Docker 19.03.1
    ▪ env HTTP_PROXY=....
    ▪ env HTTPS_PROXY=....
    ▪ env NO_PROXY=localhost,127.0.0.1,10.96.0.0/12,192.168.99.0/24,192.168.39.0/24,myip
    ▪ kubelet.resolv-conf=/run/systemd/resolve/resolv.conf
🚜  Pulling images ...
🚀  Launching Kubernetes ... 

But still kubectl does not seem to work.


$kubectl get nodes
Unable to connect to the server: Forbidden

@mohibkhan-nedian
Copy link
Author

Had to add minikube ip output to NO_PROXY.

@leson
Copy link

leson commented Sep 1, 2019

minikube start --docker-env HTTP_PROXY=http://192.168.1.9:10809 --docker-env HTTPS_PROXY=http://192.168.1.9:10809 --docker-env NO_PROXY=192.168.99.0/24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
co/none-driver kind/support Categorizes issue or PR as a support question.
Projects
None yet
Development

No branches or pull requests

3 participants