kubernetes/minikube

VM crashes after accessing a service with type loadbalancer on the loadbalancer ip on with the nodeport port (with minikube tunnel running)

Open

#4,151 建立於 2019年4月25日

在 GitHub 查看
 (23 留言) (0 反應) (0 負責人)Go (31,799 star) (5,222 fork)batch import
area/networkingarea/tunnelhelp wantedkind/buglifecycle/frozenpriority/backlog

描述

Hi, running minikube tunnel and then accessing a service with the wrong port (using the nodeport instead of the loadbalancer port) crashes minikube commands. I'm using minikube 1.0 on fedora 29.

Here are commands to reproduce:

$ ./minikube start
😄  minikube v1.0.0 on linux (amd64)
🤹  Downloading Kubernetes v1.14.0 images in the background ...
🔥  Creating virtualbox VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
📶  "minikube" IP address is 192.168.99.122
🌐  Found network options:
    ▪ HTTP_PROXY=http://10.135.89.71:3128
    ▪ HTTPS_PROXY=http://10.135.89.71:3128
🐳  Configuring Docker as the container runtime ...
    ▪ env HTTP_PROXY=http://10.135.89.71:3128
    ▪ env HTTPS_PROXY=http://10.135.89.71:3128
🐳  Version of container runtime is 18.06.2-ce
⌛  Waiting for image downloads to complete ...
✨  Preparing Kubernetes environment ...
🚜  Pulling images required by Kubernetes v1.14.0 ...
🚀  Launching Kubernetes v1.14.0 using kubeadm ... 
⌛  Waiting for pods: apiserver proxy etcd scheduler controller dns
🔑  Configuring cluster permissions ...
🤔  Verifying component health .....
💗  kubectl is now configured to use "minikube"
💡  For best results, install kubectl: https://kubernetes.io/docs/tasks/tools/install-kubectl/
🏄  Done! Thank you for using minikube!

$ kubectl create deployment hello-node --image=gcr.io/hello-minikube-zero-install/hello-node
deployment.apps/hello-node created

$ kubectl expose deployment hello-node --type=LoadBalancer --port=8080
service/hello-node exposed

$ minikube service --url hello-node 
http://192.168.99.122:30863

# the nodeport works 
$ curl http://192.168.99.122:30863 ; echo
Hello World!

# no external ip because we haven't started minikube tunnel yet
$ ./kubectl get svc
NAME         TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
hello-node   LoadBalancer   10.106.41.211   <pending>     8080:30863/TCP   78s
kubernetes   ClusterIP      10.96.0.1       <none>        443/TCP          3m30s

# now start minikube tunnel on another terminal :  $ minikube tunnel
$ ./kubectl get svc
NAME         TYPE           CLUSTER-IP      EXTERNAL-IP     PORT(S)          AGE
hello-node   LoadBalancer   10.106.41.211   10.106.41.211   8080:30863/TCP   90s
kubernetes   ClusterIP      10.96.0.1       <none>          443/TCP          3m42s

# the nodeport still works 
$ curl http://192.168.99.122:30863 ; echo
Hello World!

# the external ip and port work too
$ curl http://10.106.41.211:8080 ; echo
Hello World!

# minikube and kubectl still work too
$ minikube status
host: Running
kubelet: Running
apiserver: Running
kubectl: Correctly Configured: pointing to minikube-vm at 192.168.99.122
$ kubectl cluster-info
Kubernetes master is running at https://192.168.99.122:8443
KubeDNS is running at https://192.168.99.122:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

# optionally open another terminal and open top in the minikube vm: $ minikube ssh and then top

# This crashes minikube: using the wrong combination of loadbalancer ip and nodeport
$ curl http://10.106.41.211:30863 ; echo

# Now the ssh session running top has crashed, the vboxHeadless process spikes to 120% cpu. You have to reboot the minikube virtualbox vm to fix things.
# minikube commands don't work anymore (minikube logs, minikube ssh, minikube status)
# Note that accessing the service still works after that (through the nodeport or through the externalip and port) as well as kubectl cluster-info. Only minikube commands are crashed:
$ minikube status

💣  Error getting bootstrapper: getting kubeadm bootstrapper: command runner: getting ssh client for bootstrapper: Error dialing tcp via ssh client: ssh: handshake failed: read tcp 127.0.0.1:52960->127.0.0.1:45625: read: connection reset by peer

😿  Sorry that minikube crashed. If this was unexpected, we would love to hear from you:
👉  https://github.com/kubernetes/minikube/issues/new

貢獻者指南