开放其他端口而不是 HTTP &Traefik Ku​​bernetes Ingress 中的 HTTPS [英] Open other ports more than HTTP & HTTPS in Traefik Kubernetes Ingress

查看:19
本文介绍了开放其他端口而不是 HTTP &Traefik Ku​​bernetes Ingress 中的 HTTPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用以下配置在 Kubernetes 中将 Traefik 作为 Ingress 启动:https://github.com/RedxLus/traefik-simple-kubernetes/tree/master/V1.7

并且适用于 HTTP 和 HTTPS,但我不知道如何打开其他端口进行转发,例如,端口 3306 中带有 MySQL 的 Ingress 的 Pod

感谢您的每一个回答!

解决方案

如果您使用的是 Ingress 资源,并且该资源不支持 L4 类型的流量,则 Traefik 不支持它,如另一个答案中提到的那样.

>

但如果您使用的是 Nginx 入口控制器,则有一个解决方法,使用带有入口控制器选项 --tcp-services-configmap--udp-services-configmap 的 ConfigMap此处所述.然后你的 tcp-services ConfigMap 看起来像这样:

apiVersion: v1种类:ConfigMap元数据:名称:tcp-services命名空间:入口-nginx数据:9000:默认/示例去:8080"

这样做的好处是有一个单一的入口点到你的集群(这适用于任何将用于 TCP/UDP 的入口),但缺点是与仅仅拥有一个 Kubernetes 相比,拥有额外层的开销Service(NodePort 或 LoadBalancer)已经侦听 TCP/UDP 端口.>

I've gotten up Traefik as an Ingress in Kubernetes with this configuration: https://github.com/RedxLus/traefik-simple-kubernetes/tree/master/V1.7

And works well to HTTP and HTTPS but I don't know how can open others ports to forward, for example, a Pod with an Ingress with MySQL in port 3306

Thanks for every answer!

解决方案

Traefik doesn't support it if you are using an Ingress resource and that resource doesn't support L4 type of traffic like mentioned in the other answer.

But if you are using an Nginx ingress controller there is a workaround, use a ConfigMap with the ingress controller options --tcp-services-configmap and --udp-services-configmap as described here. Then your tcp-services ConfigMap would look something like this:

apiVersion: v1
kind: ConfigMap
metadata:
  name: tcp-services
  namespace: ingress-nginx
data:
  9000: "default/example-go:8080"

The advantage of this is having a single entry point to your cluster (this applies to any ingress that would be used for TCP/UDP) but the downside is overhead of having an extra layer compared to just simply having a Kubernetes Service (NodePort or LoadBalancer) that already listens on TCP/UDP ports.

这篇关于开放其他端口而不是 HTTP &Traefik Ku​​bernetes Ingress 中的 HTTPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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