简体   繁体   English

如何在端口80/443的公共节点IP上公开kubernetes nginx-ingress服务?

[英]How to expose kubernetes nginx-ingress service on public node IP at port 80 / 443?

I installed ingress-nginx in a cluster. 我在集群中安装了ingress-nginx I tried exposing the service with the kind: nodePort option, but this only allows for a port range between 30000-32767 (AFAIK)... I need to expose the service at port 80 for http and 443 for tls, so that I can link A Records for the domains directly to the service. 我尝试使用kind: nodePort选项公开服务,但这仅允许端口范围在30000-32767 (AFAIK)之间。我需要在http的端口80和tls的端口443公开服务,以便可以将域A Records直接链接到服务。 Does anyone know how this can be done? 有谁知道该怎么做?

I tried with type: LoadBalancer before, which worked fine, but this creates a new external Load Balancer at my cloud provider for each cluster. 我之前尝试使用type: LoadBalancer ,它可以正常工作,但这会在我的云提供商处为每个集群创建一个新的外部负载均衡器。 In my current situation I want to spawn multiple mini clusters. 在当前情况下,我想生成多个小型集群。 It would be too expensive to create a new (digitalocean) Load Balalancer for each of those, so I decided to run each cluster with it's own internal ingress-controller and expose that directly on 80/443 . 为每个集群创建一个新的(数字海洋)Load Balalancer太昂贵了,因此我决定使用它自己的内部入口控制器运行每个集群,并将其直接暴露在80/443

If you want on IP for 80 port from a service you could use the externalIP field in service config yaml. 如果要通过服务使用80端口的IP,则可以使用service config yaml中的externalIP字段。 You could find how to write the yaml here Kubernetes External IP 您可以在此处找到如何编写Yaml的Kubernetes外部IP

But if your usecase is really like getting the ingress controller up and running it does not need the service to be exposed externally. 但是,如果您的用例确实像启动并运行入口控制器,则不需要在外部公开该服务。

if you are on bare metal so change your ingress-controller service type to NodePort and add a reverse proxy to flow traffic to your ingress-controller service with selected NodePort . 如果您使用的是裸机, NodePort Ingress-controller服务类型更改为NodePort并添加一个反向代理,以使用选择的NodePort将流量流向您的Ingress-controller服务。

As @Pramod V answerd if you use externalIP in ingress-controller service so you loose real remote address in your EndPoints. 正如@Pramod V回答的那样,如果您在入口控制器服务中使用externalIP ,则您会在EndPoints中释放真实的远程地址。

A more complete answer could be found Here 可以在这里找到更完整的答案

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 kubernetes nginx 控制器中公开 80 端口 - How to expose 80 port in kubernetes nginx controller kubernetes将nginx暴露于gcp中的静态ip并带有入口服务配置错误 - kubernetes expose nginx to static ip in gcp with ingress service configuration error 如何在端口443和80的Docker群中创建Nginx服务 - How to create an nginx service in a docker swarm at port 443 and 80 Kubernetes NGINX-INGRESS 我需要运行 NGINX 服务吗? - Kubernetes NGINX-INGRESS Do I need an NGINX Service running? 使用 nginx-Ingress 在 Kubernetes 中暴露集群外的 TCP 端口 - Exposing a TCP port out of cluster in Kubernetes using nginx-Ingress 防止 NGINX-ingress 响应公共 IP - Prevent NGINX-ingress from responding to public IP 用于Azure Kubernetes Service 502错误网关的Nginx入口控制器 - nginx-ingress controller for Azure Kubernetes Service 502 Bad Gateway 我如何配置入口和Nginx入口控制器以使用相同的主机和路径将HTTP流量发送到端口80并将https流量发送到443端口 - How can i configure ingress and nginx ingress controller to send http traffic to port 80 and https traffic to 443 port, with the same host and path 在 Kubernetes 中顺序使用 Nginx Ingress 暴露服务 - Use Nginx Ingress sequentially in Kubernetes to expose service 如何在 nginx 的端口 443 上启用 grpc 而不会破坏 kubernetes 端口 80 上的 http? - How do I enable grpc on port 443 in nginx without breaking http on port 80 in kubernetes?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM