问题描述
- 我在Mac OS上使用与docker捆绑在一起的本地kubernetes.
- 我已经安装了 nginx-ingress-controller .
- 我设法通过入口发送外部http 请求到我的kubernetes托管容器(例如从本地浏览器).所有请求都是通过nginx端口80或443发送的.
- I use a local kubernetes bundled with docker on Mac OS.
- I've installed the nginx-ingress-controller.
- I manged to send external http request via ingress to my kubernetes managed containers (e.g. from my local browser). All request are sent via the nginx ports 80 or 443.
问题是,我只能通过我的ngnix控制器路由http或https请求.如何通过入口向容器发送非HTTP请求(例如数据库或corba)?
The problem is, that I can only route http or https requests via my ngnix controller.How can I send non HTTP Requests (e.g. database or corba) via ingress to my containers?
推荐答案
通过入口机制不能很好地支持它,它是未解决问题.
有一种使用nginx-ingress的tcp或udp流量的解决方法,它将使用configmap将暴露的端口映射到kubernetes服务.
参见此文档一个>.
This is not well supported via the ingress mechanism and is an open issue.
There is a work around for tcp or udp traffic using nginx-ingress which will map an exposed port to a kubernetes service using a configmap.
See this doc.
使用tcp-services-configmap
(和/或udp-services-configmap
)参数启动入口控制器.
Start the ingress controller with the tcp-services-configmap
(and/or udp-services-configmap
) argument.
args:
- "/nginx-ingress-controller"
- "--tcp-services-configmap=default/nginx-tcp-configmap"
- "--v=2"
部署配置图:
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-tcp-configmap
data:
9000: "default/example-service:8080"
其中9000
是裸露的端口,8080
是服务端口
where 9000
is the exposed port and 8080
is the service port
这篇关于Kubernetes:通过入口将非HTTP请求路由到容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!