fix(kong): use host network mode to reach internal microservices

Kong container uses network_mode:host so it shares the gateway's
network namespace and can reach 192.168.1.222:PORT directly.
Listen on 127.0.0.1:48080 (local only, Nginx proxies externally).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-07 03:52:31 -08:00
parent 099c1fe49c
commit 1d611f9a5f
1 changed files with 3 additions and 4 deletions

View File

@ -3,6 +3,7 @@ services:
image: kong:3.6-ubuntu image: kong:3.6-ubuntu
container_name: genex-kong container_name: genex-kong
restart: unless-stopped restart: unless-stopped
network_mode: host
environment: environment:
KONG_DATABASE: "off" KONG_DATABASE: "off"
KONG_DECLARATIVE_CONFIG: /etc/kong/kong.yml KONG_DECLARATIVE_CONFIG: /etc/kong/kong.yml
@ -10,15 +11,13 @@ services:
KONG_ADMIN_ACCESS_LOG: /dev/stdout KONG_ADMIN_ACCESS_LOG: /dev/stdout
KONG_PROXY_ERROR_LOG: /dev/stderr KONG_PROXY_ERROR_LOG: /dev/stderr
KONG_ADMIN_ERROR_LOG: /dev/stderr KONG_ADMIN_ERROR_LOG: /dev/stderr
KONG_PROXY_LISTEN: "0.0.0.0:8080" KONG_PROXY_LISTEN: "127.0.0.1:48080"
KONG_ADMIN_LISTEN: "127.0.0.1:8001" KONG_ADMIN_LISTEN: "127.0.0.1:48001"
# Large file upload support # Large file upload support
KONG_NGINX_PROXY_PROXY_REQUEST_BUFFERING: "off" KONG_NGINX_PROXY_PROXY_REQUEST_BUFFERING: "off"
KONG_NGINX_PROXY_CLIENT_MAX_BODY_SIZE: "500m" KONG_NGINX_PROXY_CLIENT_MAX_BODY_SIZE: "500m"
volumes: volumes:
- ./kong.yml:/etc/kong/kong.yml:ro - ./kong.yml:/etc/kong/kong.yml:ro
ports:
- "127.0.0.1:48080:8080"
healthcheck: healthcheck:
test: ["CMD", "kong", "health"] test: ["CMD", "kong", "health"]
interval: 10s interval: 10s