Starting an Ingress service on Docker for Mac

五迷三道 提交于 2019-12-07 05:04:16

问题


Update: Using:

kubectl expose deployment <Name-Of-Servce> --name=loadbalancer --port=8080 --target-port=8080 --type=LoadBalancer

The kubectl get services is showing pending:

loadbalancer                 LoadBalancer   <x.x.x.x>   <pending>     8080:32670/TCP   2m

Before Docker surported Kubernetes, I could use MiniKube and Helm:

helm install stable/jenkins
kubectl get services // To get the service name
minikube service original-llama-jenkins // << The service name

Now that we have Docker for Mac(Edge) supporting Kubernetes, how do you add an EXTERNAL-IP?

Thanks


回答1:


Unless something seriously magical has happened with "Docker for Mac," then the type: LoadBalancer is only designed for a cloud environment, where the Ingress controller can provision a cloud load balancer (i.e. AWS's ELB, GKE's ... whatever they use).

That said, one can see from your output that kubernetes has behaved as if it was type: NodePort (with your specific example showing that port 32670 goes to port 8080 on your Service). It's unclear whether you can just use that NodePort-ish port as-is, or whether the Service in "pending" state somehow means traffic will not route as expected. I guess maybe just try it?

Or you can skip the pretense and create the Service legitimately of type: NodePort, and then you and kubernetes will be on the same page about what is happening.

The other way you can chose to do things is run an in-cluster Ingress controller, such as ingress-nginx, and use virtual-hosting to expose all your services on just one port. That can be far more convenient if you have a lot of Services to expose, but it would likely be too big of a headache to set up just for one or two of them.




回答2:


Both type LoadBalancer and NodePort work on Docker for Mac Kubernetes. It's a lovely bit of magic, actually. Just hit localhost:[port]. For NodePort, a port is automatically assigned unless specified in the service definition. For type LoadBalancer, it is also specified in the service definition. Note that in using LoadBalancer, the status from kubectl will be shown as <pending> for EXTERNAL-IP but it does work.

This guy notes that it's exposed through vpnkit though I think another source would be helpful:

https://github.com/jnewland/local-dev-with-docker-for-mac-kubernetes

Edit: updated because Kubernetes is now available in stable versions of DfM.



来源:https://stackoverflow.com/questions/48244233/starting-an-ingress-service-on-docker-for-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!