Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When minikube on Mac is asked for URL, why does it instead start a service in a tunnel?

I installed the latest Docker, Minikube, and kubectl into my Mac (Catalina). I also have a recent MySQL, with the command line properly installed in the PATH. I'm using the stock terminal (zsh).

Docker started just fine, tells me of the pods it has installed.

Minikube starts fine, and kubectl get all reports on its artifacts just fine.

Jeromes-MacBook-Pro:cloudnative-statelessness jerome$ kubectl get all
NAME                         READY   STATUS    RESTARTS   AGE
pod/mysql-7dbfd4dbc4-sz8ps   1/1     Running   0          15m

NAME                 TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
service/kubernetes   ClusterIP   10.96.0.1       <none>        443/TCP          20m
service/mysql-svc    NodePort    10.111.176.15   <none>        3306:30022/TCP   15m

NAME                    READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/mysql   1/1     1            1           15m

NAME                               DESIRED   CURRENT   READY   AGE
replicaset.apps/mysql-7dbfd4dbc4   1         1         1       15m

When I run minikube service mysql-svc --url I'm expecting to get a URL, like this one from another machine: http://192.168.99.101:31067 . Instead I see something about starting a service in a 'tunnel':

Jeromes-MacBook-Pro:cloudnative-statelessness jerome$ minikube service mysql-svc --url
šŸƒ  Starting tunnel for service mysql-svc.
|-----------|-----------|-------------|------------------------|
| NAMESPACE |   NAME    | TARGET PORT |          URL           |
|-----------|-----------|-------------|------------------------|
| default   | mysql-svc |             | http://127.0.0.1:64966 |
|-----------|-----------|-------------|------------------------|
http://127.0.0.1:64966
ā—  Because you are using a Docker driver on darwin, the terminal needs to be open to run it.

At this point the terminal is non-responsive.

I'm believing that minikube service SERVICENAME should try to start a service, and also return that block of text. I'm also believing that the --url suffix should merely returns what is in the URL column, and skip starting a service.

Any good explanations of how I can get the result I want on my Mac?

And BTW, how do I recover control of the terminal session once it states "Because..." ?

Thanks,

Jerome.

UPDATE ON 8/14/2020:

I took Saravanan's advice. I uninstalled Docker from my Mac and used homebrew to install docker + docker-machine + virtualbox (see https://www.robinwieruch.de/docker-macos). When I run "minikube service mysql-svc --url" I no longer get the tunnel problem. Thank you, Saravanan.

My problems have morphed into getting a correct version of my containers (compiled apps, then run thru docker build) from Docker Hub. The YAML file I have points at my account there, but I'm afraid I've an obsolete version. What do I do to overwrite my current version on my Mac, or to delete the Docker containers so that kubectl create can get the updated version?

like image 964
Jerome Avatar asked Aug 06 '20 12:08

Jerome


People also ask

Why is the minikube tunnel?

minikube tunnel runs as a process, creating a network route on the host to the service CIDR of the cluster using the cluster's IP address as a gateway. The tunnel command exposes the external IP directly to any program running on the host operating system.

Where is minikube URL?

minikube runs on something like 192.168. 99.100 . So you should be able to access it on the NodePort you exposed your service at. For eg, say your NodePort is 30080 , then your service will be accessible as 192.168.


1 Answers

The reason for this is your minikube image is running in the container. Try changing the configuration to run it in the virtual box. Then you can reach your sql pod without tunneling.

# first delete the existing minikube image
$ minikube delete

# change the minikube driver to virtualbox
$ minikube config set vm-driver virtualbox

# start minikube again
$ minikube start

Ensure you have virtual box installed before proceeding

like image 92
Saravanan Avatar answered Sep 23 '22 18:09

Saravanan