您可以基于端口路由Kubernetes入口资源吗? [英] Can you route an Kubernetes ingress resource based on port?

查看:41
本文介绍了您可以基于端口路由Kubernetes入口资源吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Kubernetes服务,它公开了两个端口,一个用于外部接口(目标端口8080),另一个用于管理接口(目标端口8081).我想使用https通过互联网访问这两个端点,因此我想使用入口资源.入口资源为负载均衡器创建了一个静态IP,我想将端口80和443路由到外部接口(8080),将端口81(http)和端口4431(https)路由到管理接口(8081).这可能吗?如果可以,怎么办?

I have a Kubernetes service that expose two ports, one for the external interface (target port 8080) and one for the admin interface (target port 8081). I'd like to make both of these endpoints accessible over the internet using https so thus I think I want use an ingress resource. The ingress resource creates a static IP for the load balancer and I'd like to route port 80 and 443 to the external interface (8080) and port 81 (http) and port 4431 (https) to the admin interface (8081). Is this possible and if so how?

推荐答案

通过单独的Ingress对象,您应该能够将HTTP和HTTPS流量定向到不同的端口和/或服务,并且主机名可以映射到不同的端口和/或服务.

Via separate Ingress objects, you should be able to direct HTTP and HTTPS traffic to different ports and/or services, and hostnames can map to distinct ports and/or services.

但是,Ingress目前假设HTTP的端口为80,HTTPS的端口为443,因此当前无法通过Ingress将流量定向到端口81和4431.我建议为管理界面使用其他主机名.

However, Ingress currently assumes port 80 for HTTP and 443 for HTTPS for ingress, so it's not currently possible to direct traffic to ports 81 and 4431 via Ingress. I recommend using a different hostname for the admin interface.

请注意,仅1.2版支持TLS.

Note that TLS is only supported in release 1.2.

这篇关于您可以基于端口路由Kubernetes入口资源吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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