Minikube: kubectl: Unable to connect to the server: Gateway Timeout

Created on 24 Aug 2017  路  10Comments  路  Source: kubernetes/minikube

Is this a BUG REPORT or FEATURE REQUEST? (choose one):
BUG REPORT

Please provide the following details:

Environment:
DockerToolbox (incl. VirtualBox) on WIndows 7 Pro SP1 64-bit
Minikube version (use minikube version): minikube version: v0.21.0

  • OS (e.g. from /etc/os-release):
    NAME=Buildroot
    VERSION=2017.02
    ID=buildroot
    VERSION_ID=2017.02
    PRETTY_NAME="Buildroot 2017.02"
  • VM Driver (e.g. cat ~/.minikube/machines/minikube/config.json | grep DriverName): "DriverName": "virtualbox"
  • ISO version (e.g. cat ~/.minikube/machines/minikube/config.json | grep -i ISO or minikube ssh cat /etc/VERSION):
    $ cat /etc/VERSION
    testing

in config.json:
"Boot2DockerURL": "file://C:/Users/x7yv/.minikube/cache/iso/minikube-v0.23.0.iso"

  • Install tools:
  • Others:
    The above can be generated in one go with the following commands (can be copied and pasted directly into your terminal):
minikube version
echo "";
echo "OS:";
cat /etc/os-release
echo "";
echo "VM driver": 
grep DriverName ~/.minikube/machines/minikube/config.json

echo "";
echo "ISO version";
grep -i ISO ~/.minikube/machines/minikube/config.json

What happened: kubectl doesn't work. Unable to connect to the server: Gateway Timeout
C:>kubectl version
Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.0", GitCommi
t:"d3ada0119e776222f11ec7945e6d860061339aad", GitTreeState:"clean", BuildDate:"2
017-06-29T23:15:59Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"windows/amd6
4"}
Unable to connect to the server: Gateway Timeout
What you expected to happen:
able to use kubectl to deploy services
How to reproduce it (as minimally and precisely as possible):
On Windows 7 Pro, install DockerToolbox and start minikube and use kubectl
Output of minikube logs (if applicable):

Anything else do we need to know:
C:>minikube start
Starting local Kubernetes v1.7.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Starting cluster components...
Connecting to cluster...
Setting up kubeconfig...
Kubectl is now configured to use the cluster.
C:>kubectl version
Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.0", GitCommi
t:"d3ada0119e776222f11ec7945e6d860061339aad", GitTreeState:"clean", BuildDate:"2
017-06-29T23:15:59Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"windows/amd6
4"}
Unable to connect to the server: Gateway Timeout
C:>kubectl config current-context
minikube

C:>kubectl get nodes
Unable to connect to the server: Gateway Timeout

cvirtualbox lifecyclrotten

Most helpful comment

Hi,

The issue has been fixed?
I have met the similar issue.
And I found the solution in the following link:
https://stackoverflow.com/questions/38333172/kubectl-kubernetes-with-minikube-times-out

Try export no_proxy="127.0.0.1,[minikube_ip]" before kubectl run

All 10 comments

Can you post the output of minikube logs?

I am facing the same issue on Fedora linux.

[Linux ~]$ minikube version
minikube version: v0.22.2
[Linux ~]$ minikube start
Starting local Kubernetes v1.7.5 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
[Linux ~]$
[Linux ~]$
[Linux ~]$
[Linux ~]$ minikube status
minikube: Running
cluster: Running
kubectl: Correctly Configured: pointing to minikube-vm at 192.168.42.186
[Linux ~]$ kubectl get nodes
Unable to connect to the server: Gateway Timeout
[Linux ~]$ minikube ssh
_ _
_ _ ( ) ( )
___ ___ (_) ___ (_)| |/') _ _ | |_ __
/' _ _\| |/' _ \| || , < ( ) ( )| '_\ /'__\ | ( ) ( ) || || ( ) || || |\\ | (_) || |_) )( ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)\___/'(_,__/'____)

$
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1a99264cd3cb f7f45b9cb733 "/dnsmasq-nanny -v=2 " About an hour ago Up About an hour k8s_dnsmasq_kube-dns-910330662-92b5j_kube-system_dd570a53-96ec-11e7-97b0-525400884450_4
44da84ef177a a8e00546bcf3 "/kube-dns --domain=c" About an hour ago Up About an hour k8s_kubedns_kube-dns-910330662-92b5j_kube-system_dd570a53-96ec-11e7-97b0-525400884450_4
00cfe0080200 38bac66034a6 "/sidecar --v=2 --log" About an hour ago Up About an hour k8s_sidecar_kube-dns-910330662-92b5j_kube-system_dd570a53-96ec-11e7-97b0-525400884450_5
19b08b0630c0 691a82db1ecd "/dashboard --insecur" About an hour ago Up About an hour k8s_kubernetes-dashboard_kubernetes-dashboard-x2mn2_kube-system_dd102089-96ec-11e7-97b0-525400884450_4
4e5d507b4b7b 0a951668696f "/opt/kube-addons.sh" About an hour ago Up About an hour k8s_kube-addon-manager_kube-addon-manager-minikube_kube-system_5b0c47ee629af3668fe115f798f73437_6
3948b7072948 gcr.io/google_containers/pause-amd64:3.0 "/pause" About an hour ago Up About an hour k8s_POD_kubernetes-dashboard-x2mn2_kube-system_dd102089-96ec-11e7-97b0-525400884450_4
6e79cf4c67cc gcr.io/google_containers/pause-amd64:3.0 "/pause" About an hour ago Up About an hour k8s_POD_kube-addon-manager-minikube_kube-system_5b0c47ee629af3668fe115f798f73437_5
b985ce95bfd7 gcr.io/google_containers/pause-amd64:3.0 "/pause" About an hour ago Up About an hour k8s_POD_kube-dns-910330662-92b5j_kube-system_dd570a53-96ec-11e7-97b0-525400884450_4
$
$

[Linux ~]$ kubectl version
Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.5", GitCommit:"17d7182a7ccbb167074be7a87f0a68bd00d58d97", GitTreeState:"clean", BuildDate:"2017-08-31T09:14:02Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Unable to connect to the server: Gateway Timeout
[Linux ~]$

[Linux ~]$ kubectl get nodes
Unable to connect to the server: Gateway Timeout

[Linux ~]$ kubectl config view
apiVersion: v1
clusters:

  • cluster:
    certificate-authority: /home/chilakun/.minikube/ca.crt
    server: https://192.168.42.186:8443
    name: minikube
    contexts:
  • context:
    cluster: minikube
    user: minikube
    name: minikube
    current-context: minikube
    kind: Config
    preferences: {}
    users:
  • name: minikube
    user:
    client-certificate: /home/chilakun/.minikube/client.crt
    client-key: /home/chilakun/.minikube/client.key
    [Linux ~]$

[Linux ~]$ kubectl get cluster
Unable to connect to the server: Gateway Timeout
[Linux ~]$

minikube_logs.txt

The port 8443 seems to be working fine as well:

[Linux ~]$ ./paping -p 8443 192.168.42.186
paping v1.5.5 - Copyright (c) 2011 Mike Lovell

Connecting to 192.168.42.186 on TCP 8443:

Connected to 192.168.42.186: time=1.75ms protocol=TCP port=8443
Connected to 192.168.42.186: time=1.18ms protocol=TCP port=8443
Connected to 192.168.42.186: time=3.47ms protocol=TCP port=8443
Connected to 192.168.42.186: time=1.00ms protocol=TCP port=8443
Connected to 192.168.42.186: time=1.14ms protocol=TCP port=8443
Connected to 192.168.42.186: time=0.94ms protocol=TCP port=8443
Connected to 192.168.42.186: time=1.13ms protocol=TCP port=8443
Connected to 192.168.42.186: time=0.99ms protocol=TCP port=8443
Connected to 192.168.42.186: time=1.00ms protocol=TCP port=8443
Connected to 192.168.42.186: time=1.00ms protocol=TCP port=8443
Connected to 192.168.42.186: time=1.60ms protocol=TCP port=8443
Connected to 192.168.42.186: time=1.33ms protocol=TCP port=8443
Connected to 192.168.42.186: time=0.97ms protocol=TCP port=8443
Connected to 192.168.42.186: time=0.96ms protocol=TCP port=8443
Connected to 192.168.42.186: time=0.94ms protocol=TCP port=8443
Connected to 192.168.42.186: time=3.76ms protocol=TCP port=8443
Connected to 192.168.42.186: time=1.15ms protocol=TCP port=8443
^C
Connection statistics:
Attempted = 17, Connected = 17, Failed = 0 (0.00%)
Approximate connection times:
Minimum = 0.94ms, Maximum = 3.76ms, Average = 1.43ms

I am blocked on this issue. Can I hope for any help?

Hi,

The issue has been fixed?
I have met the similar issue.
And I found the solution in the following link:
https://stackoverflow.com/questions/38333172/kubectl-kubernetes-with-minikube-times-out

Try export no_proxy="127.0.0.1,[minikube_ip]" before kubectl run

@fengyd2018 : exporting no_proxy did the magic!
I had stopped working on this for a while now. So I did not check your reply earlier. Thanks for the response, It helped!

@fengyd2018 I tried exporting no_proxy as you mentioned, but it did not work (with minikube 0.25.0, kubectl 1.9.4). Interestingly enough, with minikube 0.24.1 I did not have this problem.
In case of doubt you can use strace to check whether kubectl still wants to use the proxy, e.g. strace -f -e trace=network -s 10000 kubectl get nodes (command is from https://askubuntu.com/questions/11709/how-can-i-capture-network-traffic-of-a-single-process).
I found the solution at https://stackoverflow.com/questions/41482485/kubectl-behind-a-proxy :
export NO_PROXY=$no_proxy,$(minikube ip)

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
/remove-lifecycle stale

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Was this page helpful?
0 / 5 - 0 ratings