无法在 podman 的 pod 内访问 traefik 后面的容器

Cannot acces container behind traefik inside a podman's pod

提问人:Jzbach 提问时间:11/7/2023 最后编辑:Jzbach 更新时间:11/7/2023 访问量:34

问:

阅读文档后,我了解到 a 使容器之间的通信变得容易,因为它们可以通过 .可以总结如下图:podman podlocalhost

Example from https://www.smarthomebeginner.com/images/2022/07/9-pods-drawing.webp

我在 podman 中创建了一个 pod,其中包含共享网络命名空间的命令,但端口转发除外:

podman pod create --name test_pod --share cgroup,ipc,uts

我通过执行以下操作将 pgadmin 和 traefik 放入此 pod 中:

podman run -d \
  --name pgadmin \
  --pod=test_pod \
  --label "traefik.enable=true" \
  dpage/pgadmin4:7.8

podman run -d \
  --name traefik \
  --pod=test_pod \
  --volume=./traefik.yml:/etc/traefik/traefik.yml \
  --volume=./routers/:/etc/traefik/routers/ \
  -p 8080:8080 \
  -p 8081:80 \
  -p 8433:433 \
  traefik:v2.10.5

看起来像这样:traefik.yml

...
entrypoints:
  http:
    address: :80
  https:
    address: :433
  pgadmin:
    address: :3744

providers:
  file:
    directory: /etc/traefik/routers

我的路由器很简单:

http:
  routers:
    pgadmin:
      entryPoints:
        - pgadmin
      service: pgadmin
      rule: "Host(`pgadmin.com`)"

  services:
    pgadmin:
      loadBalancer:
        servers:
          - url: http://localhost:80

在主机的机器中,我将“traefik.com”和“pgadmin.com”条目映射到主机的 ocal IP 地址。/etc/hosts

但是,我无法以任何方式访问 pgadmin。pgadmin 中的命令显示它正在侦听端口 80,并且 traefik 正确识别了路由。为什么我不能以任何方式从主机访问 pgadmin?netstat

网络编程 Traefik Podman

评论


答: 暂无答案