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

kic: fix minikube tunnel for mac #6302

Closed
medyagh opened this issue Jan 13, 2020 · 4 comments
Closed

kic: fix minikube tunnel for mac #6302

medyagh opened this issue Jan 13, 2020 · 4 comments
Assignees
Labels
co/docker-driver Issues related to kubernetes in container kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.

Comments

@medyagh
Copy link
Member

medyagh commented Jan 13, 2020

for kic on mac the tunnel doesnt seem to work.
it might be we need to do bridge like hyperkit

if h.DriverName == driver.HyperKit {

on linux it works fine:

medya@medya:~$ kubectl create deployment hello-minikube1 --image=k8s.gcr.io/echoserver:1.4
deployment.apps/hello-minikube1 created

medya@medya:~$ kubectl expose deployment hello-minikube1 --type=LoadBalancer --port=8080
service/hello-minikube1 exposed

medya@medya:~$ kubectl get svc 
NAME              TYPE           CLUSTER-IP    EXTERNAL-IP   PORT(S)          AGE
hello-minikube1   LoadBalancer   10.96.29.87   10.96.29.87   8080:30223/TCP   7s
kubernetes        ClusterIP      10.96.0.1     <none>        443/TCP          3m3s

medya@medya:~$ curl 10.96.29.87:8080
CLIENT VALUES:
client_address=10.244.0.1
command=GET
real path=/
query=nil
request_version=1.1
request_uri=http://10.96.29.87:8080/

SERVER VALUES:
server_version=nginx: 1.10.0 - lua: 10001

HEADERS RECEIVED:
accept=*/*
host=10.96.29.87:8080
user-agent=curl/7.66.0
BODY:
-no body in request-medya@medya:~$ 

@medyagh medyagh added the co/docker-driver Issues related to kubernetes in container label Jan 13, 2020
@medyagh medyagh changed the title kic: clearify minikube service and tunnel kic: fix minikube tunnel Jan 14, 2020
@medyagh medyagh changed the title kic: fix minikube tunnel kic: fix minikube tunnel for non-linux Jan 14, 2020
@medyagh medyagh added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. kind/bug Categorizes issue or PR as related to a bug. labels Jan 22, 2020
@medyagh medyagh changed the title kic: fix minikube tunnel for non-linux kic: fix minikube tunnel for mac Jan 28, 2020
@medyagh
Copy link
Member Author

medyagh commented Jan 28, 2020

hint comment from @josedonizetti

kic for mac there's another layer, right?
tunnel -> hyperkit -> k8s
tunnel -> docker -> hyperkit -> k8s
kic is the second

@josedonizetti
Copy link
Member

josedonizetti commented Jan 29, 2020

docker for mac has a bunch of network limitations. I don't think we can get tunnel working like we have for linux, by exposing the cluster IP to the host. Docker for mac currently doesn't allow the host to ping containers, the recommend approach is exposing a container port on the host:

eg:

docker run --publish 8000:80 --name webserver nginx

But this also doesn't work for Kic, because we don't know before hand which ports will be exposed by a service, and docker for mac only allow ports expositions when creating the container.

The best solution I think we should do here, is use the exposing port concept, but using ssh to create a tunnel for it on a running kic container:

eg:

minikube start --vm-driver=docker

kubectl create deployment hello-minikube1 --image=k8s.gcr.io/echoserver:1.4
kubectl expose deployment hello-minikube1 --type=LoadBalancer --port=8080

kubectl get svc # get the CLUSTER-IP here
docker ps # get KIC SSH PORT
ssh -f [email protected] -p <KIC-SSH-PORT> -i ~/.minikube/machines/minikube/id_rsa -L 8080:<CLUSTER-IP>:8080  -N

curl LOCALHOST:8080 # this should work

The tunnel can be managed by minikube tunnel, it will keep checking for exposed service on the cluster and creating/closing ssh tunnels on the host for it.

@medyagh what do you think?

I can implement this, but considering my free time now, it would take me 2 weeks to finish. Is that okay?

@medyagh
Copy link
Member Author

medyagh commented Jan 29, 2020

I think think this is a smiple solution and we take advantage of our openssh server inside the container. I talked to @tstromberg about this. one limitation is if we could do service DNS using this approach.

and do alternatvies to this solution (creating a hyperkit vm for the tunnel) have the same service dns limitation ?

@medyagh
Copy link
Member Author

medyagh commented Feb 25, 2020

fixed by #6460

@medyagh medyagh closed this as completed Feb 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
co/docker-driver Issues related to kubernetes in container kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
Development

No branches or pull requests

3 participants