【发布时间】:2017-11-15 14:34:00
【问题描述】:
我在我的 Kubernetes Pod 中运行 NodeJS 映像,同时公开特定端口 (9080),并将 Traefik 作为侧车容器作为反向代理运行。如何从 Deployment 模板中指定 Traefik 路由。
部署
apiVersion: apps/v1beta1
kind: Deployment
metadata:
labels:
app: web
name: web-controller
spec:
replicas: 1
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- image: "nodeJS-image"
name: web
ports:
- containerPort: 9080
name: http-server
- image: "traefik-image"
name: traefik-proxy
ports:
- containerPort: 80
name: traefik-proxy
- containerPort: 8080
name: traefik-ui
args:
- --web
- --kubernetes
【问题讨论】:
-
你能澄清一下“指定(ing)Traefik路线”的意思吗?那部分我不清楚。
-
即定义
traefik.frontend.rule=Host:machine-echo.example.com等标签,类似于在dockers上使用Traefik。简而言之,我需要 Traefik 将请求转发到暴露在 Pod 内端口 9080 的nodeJS-image容器。如果我使用了不准确的术语,我们深表歉意。 -
好的,所以我认为我知道你的意思并添加了一个答案。让我知道这是否符合您的问题。
标签: node.js kubernetes traefik