我想使用trafik自动发现kubernetes服务。docker-compose。Yaml是这样的:
version: "3.3"
services:
traefik:
image: "traefik:v2.5"
version: "3.3"
services:
whoami:
image: "traefik/whoami"
container_name: "simple-service"
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`whoami.com`)"
- "traefik.http.routers.whoami.entrypoints=web"
并运行docker-compose up -d is working,the whoami.com发现。
但是当我将它转换为kubernetes yaml时,我得到了标签错误,如何在kubernetes上写标签?
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`whoami.com`)"
- "traefik.http.routers.whoami.entrypoints=web"
查看Kompose。
它会帮你生成一些东西。但是对于Traefik来说,你必须切换到入口系统或Traefik的自定义入口路由系统。请参阅本文档了解前者,后者在侧栏中有链接。