在Mac上的Docker上启动Ingress服务 [英] Starting an Ingress service on Docker for Mac

查看:456
本文介绍了在Mac上的Docker上启动Ingress服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新: 使用:

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

kubectl get services显示为待处理:

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

在Docker支持Kubernetes之前,我可以使用MiniKube和Helm:

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

现在我们有了支持Kubernetes的Docker for Mac(Edge),如何添加EXTERNAL-IP?

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

谢谢

推荐答案

除非"Docker for Mac"发生了非常神奇的事情,否则type: LoadBalancer仅适用于Ingress控制器可以 href ="https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/" rel ="nofollow noreferrer">配置云负载均衡器(即AWS的ELB ,GKE的...无论他们使用什么.)

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).

也就是说,从您的输出中可以看到kubernetes的行为就像type: NodePort一样(您的特定示例显示端口32670进入了服务上的端口8080).目前尚不清楚您是否可以按原样使用NodePort ish端口,或者服务处于挂起"状态是否某种程度上意味着流量将无法按预期进行路由.我想也许可以尝试一下?

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?

或者您可以跳过伪装并合法地创建type: NodePort的服务,然后您和kubernetes将在同一页面上了解正在发生的事情.

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.

您可以选择执行操作的另一种方法是运行集群内的Ingress控制器,例如

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.

这篇关于在Mac上的Docker上启动Ingress服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆