How do we expose additional TCP ports from a container in Kamal 2 using kamal-proxy? #962
Unanswered
navinpeiris
asked this question in
Q&A
Replies: 2 comments 4 replies
-
To expose additional TCP ports for EPMD in Kamal 2, you can use the
For example: service: your_app_name
image: your_docker_image:tag
servers:
web:
hosts:
- your_server_ip_or_hostname
health_check:
path: /healthz
port: 4000
env:
clear:
PORT: 4000
accessories:
tcp_proxy:
image: traefik:v2.5
roles: [web]
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
command:
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --entrypoints.web.address=:80
- --entrypoints.epmd.address=:4369
- --entrypoints.distribution.address=:9000-9100
ports:
- 80:80
- 4369:4369
- 9000-9100:9000-9100
traefik_labels: &traefik_labels
- traefik.enable=true
- traefik.http.routers.${SERVICE_NAME}.rule=Host(`${DOMAINS}`)
- traefik.http.routers.${SERVICE_NAME}.entrypoints=web
- traefik.tcp.routers.epmd.rule=HostSNI(`*`)
- traefik.tcp.routers.epmd.entrypoints=epmd
- traefik.tcp.routers.epmd.service=epmd
- traefik.tcp.services.epmd.loadbalancer.server.port=4369
- traefik.tcp.routers.distribution.rule=HostSNI(`*`)
- traefik.tcp.routers.distribution.entrypoints=distribution
- traefik.tcp.routers.distribution.service=distribution
- traefik.tcp.services.distribution.loadbalancer.server.port=9000-9100
labels:
<<: *traefik_labels I hope that helps. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks for that @geek411! In case it helps anyone else, this is the config that ended up working for me: accessories:
traefik:
service: traefik
image: traefik:v3.1
roles:
- web
options:
publish:
- 4369:4369
- 9100:9100
cmd: "--providers.docker --providers.docker.exposedByDefault=false --entryPoints.epmd.address=:4369 --entryPoints.beam.address=:9100 --log.level=INFO"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
labels:
traefik.enable: true
traefik.tcp.routers.epmd.rule: "ClientIP(`0.0.0.0/0`)"
traefik.tcp.routers.epmd.priority: 5
traefik.tcp.routers.epmd.entryPoints: epmd
traefik.tcp.routers.epmd.service: epmd
traefik.tcp.services.epmd.loadBalancer.server.port: 4369
traefik.tcp.routers.beam.rule: "ClientIP(`0.0.0.0/0`)"
traefik.tcp.routers.beam.priority: 5
traefik.tcp.routers.beam.entryPoints: beam
traefik.tcp.routers.beam.service: beam
traefik.tcp.services.beam.loadBalancer.server.port: 9100 |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all!
I've got a case where I need to expose some additional TCP ports from the container. It's an elixir app that needs to expose two ports for EPMD so that we can connect all the nodes in the cluster.
Currently, using Kamal 1.x, I'm able to do this using traefik labels, but going through Kamal 2 and kamal-proxy code, it wasn't clear if it was possible.
Cheers!
Beta Was this translation helpful? Give feedback.
All reactions