I am using traefik v2.4 and I am experiencing a very weird problem with the my grpc service and I cant access it. Although, I can access the rest endpoints under the same container as the grpc endpoints.
I can also access other containers that use http and not h2c.
here is my docker-compose.yml
version: '3.7'
services:
traefik:
image: "traefik:v2.4"
command:
- --api.insecure=true
- --api.debug=true
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --providers.docker.watch
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
ports:
- "80:80"
- "433:433"
- "8080:8080"
networks:
- backend
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
# works
whoami:
image: "traefik/whoami"
networks:
- backend
labels:
- traefik.enable=true
- traefik.http.routers.whoami.rule=Host(`whoami.localhost`)
# works and redirect grpc-web requests to the below service
envoy:
image: envoyproxy/envoy:v1.16.0
volumes:
- ./envoy/configs/envoy-for-internal.yaml:/etc/envoy/envoy.yaml
networks:
- backend
labels:
- traefik.enable=true
- traefik.http.routers.envoy.rule=Host(`grpc-web.localhost`)
- traefik.http.services.envoy.loadbalancer.server.port=8080 # 8080 is the default envoy port
brain:
image: 'registry.gitlab.com/somaproject/e-boubouniera/go-backend/brain:latest-dev'
volumes:
- ../cmd/brain/config-internal.yml:/app/config.yml
- ../cmd/brain/logs:/app/logs
networks:
- backend
labels:
- traefik.enable=true
- "traefik.http.middlewares.serviceheaders.headers.accesscontrolalloworiginlist=*"
# GRPC (I got DNS resolution failed by using BloomRPC grpc client)
- "traefik.http.routers.grpc-brain.rule=Host(`grpc.localhost`)"
- "traefik.http.services.grpc-brain.loadbalancer.server.scheme=h2c"
- "traefik.http.services.grpc-brain.loadbalancer.server.port=9001"
- "traefik.http.routers.grpc-brain.service=grpc-brain"
- "traefik.http.routers.grpc-brain.middlewares=serviceheaders"
# REST (works with postman)
- "traefik.http.routers.rest-brain.rule=Host(`rest.localhost`)"
- "traefik.http.services.rest-brain.loadbalancer.server.port=9002"
- "traefik.http.routers.rest-brain.service=rest-brain"
- "traefik.http.routers.rest-brain.middlewares=serviceheaders"
stop_grace_period: 1m10s
stop_signal: SIGINT
devdb:
image: postgres:12
environment:
POSTGRES_USER: "root"
POSTGRES_PASSWORD: "example"
POSTGRES_DB: "devdb"
volumes:
- ../.volumes/postgres:/var/lib/postgresql/data
- ../database/init-db:/docker-entrypoint-initdb.d/
ports:
- "5434:5432"
networks:
- backend
networks:
backend:
driver: bridge
From traefik access logs, I can see that my calls never arrive to the traefik service
I cant understand why the grpc is not working. Any help please ?