apache / apisix

The Cloud-Native API Gateway
https://apisix.apache.org/blog/
Apache License 2.0
14.57k stars 2.52k forks source link

request help: APISIX cannot resolve hostname as etcd endpoint in docker #7008

Closed prajith-nair closed 1 year ago

prajith-nair commented 2 years ago

Current Behavior

apisix_conf/config.yaml

apisix:
  node_listen: 9080              # APISIX listening port
  enable_ipv6: false

  allow_admin:                  # http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
    - 0.0.0.0/0              # We need to restrict ip access rules for security. 0.0.0.0/0 is for test.

  admin_key:
    - name: "admin"
      key: xxxxx
      role: admin                 # admin: manage all configuration data
      # viewer: only can view configuration data
    - name: "viewer"
      key: xxxxx
      role: viewer

  enable_control: true
  control:
    ip: "0.0.0.0"
    port: 9092

etcd:
  host:                           # it's possible to define multiple etcd hosts addresses of the same etcd cluster.
    - "http://labindia01_etcd:2379"     # multiple etcd address, if your etcd cluster enables TLS, please use https scheme,
    # e.g. https://127.0.0.1:2379.
  prefix: /apisix                 # apisix configurations prefix
  timeout: 30                     # 30 seconds
  health_check_retry: 2           # etcd retry time that only affects the health check, default 2
  tls:
    verify: false                

plugin_attr:
  prometheus:
    export_addr:
      ip: "0.0.0.0"
      port: 9091`

etcd.conf.yml :

# This is the configuration file for the etcd server.

# Human-readable name for this member.
name: 'default'

# Path to the data directory.
data-dir:

# Path to the dedicated wal directory.
wal-dir:

# Number of committed transactions to trigger a snapshot to disk.
snapshot-count: 10000

# Time (in milliseconds) of a heartbeat interval.
heartbeat-interval: 100

# Time (in milliseconds) for an election to timeout.
election-timeout: 1000

# Raise alarms when backend size exceeds the given quota. 0 means use the
# default quota.
quota-backend-bytes: 0

# List of comma separated URLs to listen on for peer traffic.
listen-peer-urls: http://localhost:2380

# List of comma separated URLs to listen on for client traffic.
listen-client-urls: http://localhost:2379

# Maximum number of snapshot files to retain (0 is unlimited).
max-snapshots: 5

# Maximum number of wal files to retain (0 is unlimited).
max-wals: 5

# Comma-separated white list of origins for CORS (cross-origin resource sharing).
cors:

# List of this member's peer URLs to advertise to the rest of the cluster.
# The URLs needed to be a comma-separated list.
initial-advertise-peer-urls: http://localhost:2380

# List of this member's client URLs to advertise to the public.
# The URLs needed to be a comma-separated list.
advertise-client-urls: http://localhost:2379

# Discovery URL used to bootstrap the cluster.
discovery:

# Valid values include 'exit', 'proxy'
discovery-fallback: 'proxy'

# HTTP proxy to use for traffic to discovery service.
discovery-proxy:

# DNS domain used to bootstrap initial cluster.
discovery-srv:

# Initial cluster configuration for bootstrapping.
initial-cluster:

# Initial cluster token for the etcd cluster during bootstrap.
initial-cluster-token: 'etcd-cluster'

# Initial cluster state ('new' or 'existing').
initial-cluster-state: 'new'

# Reject reconfiguration requests that would cause quorum loss.
strict-reconfig-check: false

# Accept etcd V2 client requests
enable-v2: true

# Enable runtime profiling data via HTTP server
enable-pprof: true

# Valid values include 'on', 'readonly', 'off'
proxy: 'off'

# Time (in milliseconds) an endpoint will be held in a failed state.
proxy-failure-wait: 5000

# Time (in milliseconds) of the endpoints refresh interval.
proxy-refresh-interval: 30000

# Time (in milliseconds) for a dial to timeout.
proxy-dial-timeout: 1000

# Time (in milliseconds) for a write to timeout.
proxy-write-timeout: 5000

# Time (in milliseconds) for a read to timeout.
proxy-read-timeout: 0

client-transport-security:
  # Path to the client server TLS cert file.
  cert-file:

  # Path to the client server TLS key file.
  key-file:

  # Enable client cert authentication.
  client-cert-auth: false

  # Path to the client server TLS trusted CA cert file.
  trusted-ca-file:

  # Client TLS using generated certificates
  auto-tls: false

peer-transport-security:
  # Path to the peer server TLS cert file.
  cert-file:

  # Path to the peer server TLS key file.
  key-file:

  # Enable peer client cert authentication.
  client-cert-auth: false

  # Path to the peer server TLS trusted CA cert file.
  trusted-ca-file:

  # Peer TLS using generated certificates.
  auto-tls: false

# Enable debug-level logging for etcd.
debug: false

logger: zap

# Specify 'stdout' or 'stderr' to skip journald logging even when running under systemd.
log-outputs: [stderr]

# Force to create a new one member cluster.
force-new-cluster: false

auto-compaction-mode: periodic
auto-compaction-retention: "1"`

docker-compose.yml

  ################################################################################
  # APISIX for traffic management
  apisix-dashboard:
    hostname: "{{.Service.Name}}"
    image: apache/apisix-dashboard:2.10.1-alpine
    restart: always
    ports:
      - "9000:9000"
    configs:
      - source: apisixdashboard-config
        target: /usr/local/apisix-dashboard/conf/conf.yaml
        mode: 0444
    networks:
      my-stack-network:
    deploy:
      restart_policy:
        condition: any
      update_config:
        # ensure at least one instance runs when updating
        order: start-first
      resources:
        limits:
          memory: 100M
        reservations:
          memory: 100M
      placement:
        constraints:
          - ${SERVICE_CONSTRAINT:-node.role==worker}
    logging:
      driver: "syslog"
      options:
        syslog-address: "udp://127.0.0.1:${RSYSLOG_EXPOSED_PORT:-10000}"
        tag: "apisix-dashboard/{{.Name}}/container.log"
        syslog-facility: local2
        syslog-format: rfc3164
  apisix:
    hostname: "{{.Service.Name}}"
    image: apache/apisix:2.13.1-alpine
    #command: /bin/sh -c 'sleep 300'
    restart: always
    depends_on:
      - etcd
    #network_mode: host
    ports:
      - "9080:9080/tcp"
      - "9091:9091/tcp"
      - "9443:9443/tcp"
      - "9092:9092/tcp"
    configs:
      - source: apisix-config
        target: /usr/local/apisix/conf/config.yaml
        mode: 0444
    networks:
      my-stack-network:
        aliases:
          - apisix
    deploy:
      restart_policy:
        condition: any
      update_config:
        # ensure at least one instance runs when updating
        order: start-first
      resources:
        limits:
          memory: 100M
        reservations:
          memory: 100M
      placement:
        constraints:
          - ${SERVICE_CONSTRAINT:-node.role==worker}
    logging:
      driver: "syslog"
      options:
        syslog-address: "udp://127.0.0.1:${RSYSLOG_EXPOSED_PORT:-10000}"
        tag: "apisix/{{.Name}}/container.log"
        syslog-facility: local2
        syslog-format: rfc3164
  etcd:
    hostname: "{{.Service.Name}}"
    image: bitnami/etcd:3.5.4
    restart: always
    volumes:
      - etcd_data:/bitnami/etcd
    environment:
      ETCD_ENABLE_V2: "true"
      ALLOW_NONE_AUTHENTICATION: "yes"
      ETCD_ADVERTISE_CLIENT_URLS: "http://0.0.0.0:2379"
      ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379"
    ports:
      - "2379:2379/tcp"
    networks:
      my-stack-network:
        aliases:
          - etcd
    deploy:
      restart_policy:
        condition: any
      update_config:
        # ensure at least one instance runs when updating
        order: start-first
      resources:
        limits:
          memory: 100M
        reservations:
          memory: 100M
      placement:
        constraints:
          - ${SERVICE_CONSTRAINT:-node.role==worker}
    logging:
      driver: "syslog"
      options:
        syslog-address: "udp://127.0.0.1:${RSYSLOG_EXPOSED_PORT:-10000}"
        tag: "etcd/{{.Name}}/container.log"
        syslog-facility: local2
        syslog-format: rfc3164

I can ping etcd container from other containers in same docker network.

/usr/local/apisix-dashboard # ping labindia01_etcd PING labindia01_etcd (10.0.32.21): 56 data bytes 64 bytes from 10.0.32.21: seq=0 ttl=64 time=0.106 ms 64 bytes from 10.0.32.21: seq=1 ttl=64 time=0.086 ms 64 bytes from 10.0.32.21: seq=2 ttl=64 time=0.075 ms 64 bytes from 10.0.32.21: seq=3 ttl=64 time=0.105 ms 64 bytes from 10.0.32.21: seq=4 ttl=64 time=0.072 ms

Below is /etc/hosts details from labindia01_etcd (etcd container) @labindia01_etcd:/opt/bitnami/etcd/bin$ cat /etc/hosts 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters 10.0.32.31 labindia01_etcd

However, defining hostname in config.yaml of apisix like below, would lead to apisix service to fail

etcd:
  host:                           # it's possible to define multiple etcd hosts addresses of the same etcd cluster.
    - "http://labindia01_etcd:2379"     # multiple etcd address, if your etcd cluster enables TLS, please use https scheme,
    # e.g. https://127.0.0.1:2379.
  prefix: /apisix                 # apisix configurations prefix
  timeout: 30                     # 30 seconds
   tls:
      verify: false 

replacing etcd container IP 10.0.32.31 in api config.yml works as expected.

Expected Behavior

apisix service should come up with hostname defined in config.yml

!@labindia01_etcd:/opt/bitnami/etcd/bin$ cat /etc/hosts 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters 10.0.32.31 labindia01_etcd

Before

etcd:
    host:
        - "http://127.0.0.1:2379"

ETCD_HOST being hostname of container (labindia01_etcd) should resolve in apisix

After

etcd:
    host:
        - "http://labindia01_etcd:2379"

Error Logs

labindia01_apisix.1.p3m2ok88e93c@xxxxxx    |
labindia01_apisix.1.u2pazna86jp8@xxxxxx    | /usr/local/openresty/luajit/bin/luajit ./apisix/cli/apisix.lua init_etcd
labindia01_apisix.1.p3m2ok88e93c@xxxxxx    | /usr/local/openresty/luajit/bin/luajit ./apisix/cli/apisix.lua init_etcd
labindia01_apisix.1.u2pazna86jp8@xxxxxx    | 2022/05/09 05:36:53 [error] 1#1: init_by_lua error: /usr/local/apisix/apisix/core/config_etcd.lua:816: attempt to concatenate local 'err' (a nil value)
labindia01_apisix.1.p3m2ok88e93c@xxxxxx    | 2022/05/09 05:36:39 [error] 1#1: init_by_lua error: /usr/local/apisix/apisix/core/config_etcd.lua:816: attempt to concatenate local 'err' (a nil value)
labindia01_apisix.1.u2pazna86jp8@xxxxxx    | stack traceback:
labindia01_apisix.1.p3m2ok88e93c@xxxxxx    | stack traceback:
labindia01_apisix.1.u2pazna86jp8@xxxxxx    |    /usr/local/apisix/apisix/core/config_etcd.lua:816: in function 'init'
labindia01_apisix.1.u2pazna86jp8@xxxxxx    |    /usr/local/apisix/apisix/init.lua:84: in function 'http_init'
labindia01_apisix.1.p3m2ok88e93c@xxxxxx    |    /usr/local/apisix/apisix/core/config_etcd.lua:816: in function 'init'
labindia01_apisix.1.u2pazna86jp8@xxxxxx    |    init_by_lua:9: in main chunk
labindia01_apisix.1.p3m2ok88e93c@xxxxxx    |    /usr/local/apisix/apisix/init.lua:84: in function 'http_init'
labindia01_apisix.1.p3m2ok88e93c@xxxxxx    |    init_by_lua:9: in main chunk
labindia01_apisix.1.u2pazna86jp8@xxxxxx    | nginx: [error] init_by_lua error: /usr/local/apisix/apisix/core/config_etcd.lua:816: attempt to concatenate local 'err' (a nil value)
labindia01_apisix.1.u2pazna86jp8@xxxxxx    | stack traceback:
labindia01_apisix.1.u2pazna86jp8@xxxxxx    |    /usr/local/apisix/apisix/core/config_etcd.lua:816: in function 'init'
labindia01_apisix.1.p3m2ok88e93c@xxxxxx    | nginx: [error] init_by_lua error: /usr/local/apisix/apisix/core/config_etcd.lua:816: attempt to concatenate local 'err' (a nil value)
labindia01_apisix.1.tto2u9kbjiqm@xxxxxx    |    /usr/local/apisix/apisix/init.lua:84: in function 'http_init'
labindia01_apisix.1.p3m2ok88e93c@xxxxxx    | stack traceback:
labindia01_apisix.1.tto2u9kbjiqm@xxxxxx    |    init_by_lua:9: in main chunk
labindia01_apisix.1.p3m2ok88e93c@xxxxxx    |    /usr/local/apisix/apisix/core/config_etcd.lua:816: in function 'init'
labindia01_apisix.1.hy71wbvj83bk@xxxxxx    |    /usr/local/apisix/apisix/init.lua:84: in function 'http_init'
labindia01_apisix.1.hy71wbvj83bk@xxxxxx    |    init_by_lua:9: in main chunk
labindia01_apisix.1.p3m2ok88e93c@xxxxxx    |    /usr/local/apisix/apisix/init.lua:84: in function 'http_init'
labindia01_apisix.1.p3m2ok88e93c@xxxxxx    |    init_by_lua:9: in main chunk
labindia01_apisix.1.u2pazna86jp8@xxxxxx    |    /usr/local/apisix/apisix/init.lua:84: in function 'http_init'
labindia01_apisix.1.u2pazna86jp8@xxxxxx    |    init_by_lua:9: in main chunk

Steps to Reproduce

  1. Deploy stack using below docker-compose.yml
version: "3.8"
services:
  ################################################################################
  # APISIX for traffic management
  apisix-dashboard:
    hostname: "{{.Service.Name}}"
    image: apache/apisix-dashboard:2.10.1-alpine
    restart: always
    ports:
      - "9000:9000"
    configs:
      - source: apisixdashboard-config
        target: /usr/local/apisix-dashboard/conf/conf.yaml
        mode: 0444
    networks:
     my-stack-network:
    deploy:
      restart_policy:
        condition: any
      update_config:
        # ensure at least one instance runs when updating
        order: start-first
      resources:
        limits:
          memory: 100M
        reservations:
          memory: 100M
      placement:
        constraints:
          - ${SERVICE_CONSTRAINT:-node.role==worker}
    logging:
      driver: "syslog"
      options:
        syslog-address: "udp://127.0.0.1:${RSYSLOG_EXPOSED_PORT:-10000}"
        tag: "apisix-dashboard/{{.Name}}/container.log"
        syslog-facility: local2
        syslog-format: rfc3164
  apisix:
    hostname: "{{.Service.Name}}"
    image: apache/apisix:2.13.1-alpine
    #command: /bin/sh -c 'sleep 300'
    restart: always
    depends_on:
      - etcd
    #network_mode: host
    ports:
      - "9080:9080/tcp"
      - "9091:9091/tcp"
      - "9443:9443/tcp"
      - "9092:9092/tcp"
    configs:
      - source: apisix-config
        target: /usr/local/apisix/conf/config.yaml
        mode: 0444
    networks:
     my-stack-network:
        aliases:
          - apisix
    deploy:
      restart_policy:
        condition: any
      update_config:
        # ensure at least one instance runs when updating
        order: start-first
      resources:
        limits:
          memory: 100M
        reservations:
          memory: 100M
      placement:
        constraints:
          - ${SERVICE_CONSTRAINT:-node.role==worker}
    logging:
      driver: "syslog"
      options:
        syslog-address: "udp://127.0.0.1:${RSYSLOG_EXPOSED_PORT:-10000}"
        tag: "apisix/{{.Name}}/container.log"
        syslog-facility: local2
        syslog-format: rfc3164
  etcd:
    hostname: "{{.Service.Name}}"
    image: bitnami/etcd:3.5.4
    restart: always
    volumes:
      - etcd_data:/bitnami/etcd
    environment:
      ETCD_ENABLE_V2: "true"
      ALLOW_NONE_AUTHENTICATION: "yes"
      ETCD_ADVERTISE_CLIENT_URLS: "http://0.0.0.0:2379"
      ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379"
    ports:
      - "2379:2379/tcp"
    networks:
     my-stack-network:
        aliases:
          - etcd
    deploy:
      restart_policy:
        condition: any
      update_config:
        # ensure at least one instance runs when updating
        order: start-first
      resources:
        limits:
          memory: 100M
        reservations:
          memory: 100M
      placement:
        constraints:
          - ${SERVICE_CONSTRAINT:-node.role==worker}
    logging:
      driver: "syslog"
      options:
        syslog-address: "udp://127.0.0.1:${RSYSLOG_EXPOSED_PORT:-10000}"
        tag: "etcd/{{.Name}}/container.log"
        syslog-facility: local2
        syslog-format: rfc3164

networks:
 my-stack-network:

volumes:
  etcd_data:
    driver: local

configs:

  apisix-config:
    name: ${DOCKER_STACK}_apisix-config-v1
    file: ${DEPLOYMENT_HOME}/resources/apisix/apisix_conf/config.yaml
  apisixdashboard-config:
    name: ${DOCKER_STACK}_apisixdashboard-config-v1
    file: ${DEPLOYMENT_HOME}/resources/apisix/dashboard_conf/conf.yaml
  1. List the docker service and notice docker service for apisix doesnt comeup as expected. qoij49qbfiad labindia01_apisix replicated 0/1 apache/apisix:2.13.1-alpine *:9080->9080/tcp, *:9091-9092->9091-9092/tcp, *:9443->9443/tcp

  2. Check docker service log labindia01_apisix for potential errors

Environment

@labindia01_etcd:/opt/bitnami/etcd/bin$ ./etcdctl member list 224bff4639e481b9, started, default, http://172.18.0.6:2380, http://0.0.0.0:2379, false

tokers commented 2 years ago

Have you ever signed in to the APISIX container and cat the /etc/hosts? You can edit the ETCD address to the IP address in APISIX config.yaml so that this container can run normally.

prajith-nair commented 2 years ago

When we provide etcd container IP via config.yaml it does work as expected. However, we want it to be working with hostname supplied via config.yaml

Below logs are after we edited config.yaml and supplied etcd container IP

labindia01 (master)nsg-customers$docker service logs labindia01_apisix
labindia01_apisix.1.l475yve866q8@xxxx    | /usr/local/openresty/luajit/bin/luajit ./apisix/cli/apisix.lua init
labindia01_apisix.1.l475yve866q8@xxxx    |
labindia01_apisix.1.l475yve866q8@xxxx    | WARNING: using fixed Admin API token has security risk.
labindia01_apisix.1.l475yve866q8@xxxx    | Please modify "admin_key" in conf/config.yaml .
labindia01_apisix.1.l475yve866q8@xxxx    |
labindia01_apisix.1.l475yve866q8@xxxx    |
labindia01_apisix.1.l475yve866q8@xxxx    | /usr/local/openresty/luajit/bin/luajit ./apisix/cli/apisix.lua init_etcd
labindia01_apisix.1.l475yve866q8@xxxx    | 2022/05/09 09:44:03 [warn] 43#43: *3 [lua] plugin.lua:173: load(): new plugins: {"grpc-transcode":true,"splunk-hec-logging":true,"consumer-restriction":true,"ua-restriction":true,"hmac-auth":true,"referer-restriction":true,"api-breaker":true,"limit-count":true,"loggly":true,"jwt-auth":true,"public-api":true,"openwhisk":true,"gzip":true,"syslog":true,"ext-plugin-pre-req":true,"request-id":true,"aws-lambda":true,"redirect":true,"client-control":true,"prometheus":true,"forward-auth":true,"http-logger":true,"kafka-logger":true,"udp-logger":true,"echo":true,"skywalking-logger":true,"response-rewrite":true,"traffic-split":true,"google-cloud-logging":true,"ip-restriction":true,"ldap-auth":true,"key-auth":true,"serverless-post-function":true,"zipkin":true,"proxy-rewrite":true,"ext-plugin-post-req":true,"serverless-pre-function":true,"clickhouse-logger":true,"tcp-logger":true,"authz-keycloak":true,"openid-connect":true,"uri-blocker":true,"real-ip":true,"opa":true,"proxy-control":true,"csrf":true,"basic-auth":true,"authz-casbin":true,"server-info":true,"proxy-mirror":true,"limit-conn":true,"limit-req":true,"sls-logger":true,"fault-injection":true,"azure-functions":true,"proxy-cache":true,"grpc-web":true,"mocking":true,"wolf-rbac":true,"datadog":true,"file-logger":true,"cors":true,"rocketmq-logger":true,"request-validation":true,"example-plugin":true}, context: init_worker_by_lua*
labindia01_apisix.1.l475yve866q8@xxxx    | 2022/05/09 09:44:03 [warn] 47#47: *1 [lua] plugin.lua:173: load(): new plugins: {"grpc-transcode":true,"splunk-hec-logging":true,"consumer-restriction":true,"ua-restriction":true,"hmac-auth":true,"referer-restriction":true,"api-breaker":true,"limit-count":true,"loggly":true,"jwt-auth":true,"public-api":true,"openwhisk":true,"gzip":true,"syslog":true,"ext-plugin-pre-req":true,"request-id":true,"aws-lambda":true,"redirect":true,"client-control":true,"prometheus":true,"forward-auth":true,"http-logger":true,"kafka-logger":true,"udp-logger":true,"echo":true,"skywalking-logger":true,"response-rewrite":true,"traffic-split":true,"google-cloud-logging":true,"ip-restriction":true,"ldap-auth":true,"key-auth":true,"serverless-post-function":true,"zipkin":true,"proxy-rewrite":true,"ext-plugin-post-req":true,"serverless-pre-function":true,"clickhouse-logger":true,"tcp-logger":true,"authz-keycloak":true,"openid-connect":true,"uri-blocker":true,"real-ip":true,"opa":true,"proxy-control":true,"csrf":true,"basic-auth":true,"authz-casbin":true,"server-info":true,"proxy-mirror":true,"limit-conn":true,"limit-req":true,"sls-logger":true,"fault-injection":true,"azure-functions":true,"proxy-cache":true,"grpc-web":true,"mocking":true,"wolf-rbac":true,"datadog":true,"file-logger":true,"cors":true,"rocketmq-logger":true,"request-validation":true,"example-plugin":true}, context: init_worker_by_lua*
labindia01_apisix.1.l475yve866q8@xxxx    | 2022/05/09 09:44:03 [warn] 44#44: *2 [lua] plugin.lua:173: load(): new plugins: {"grpc-transcode":true,"splunk-hec-logging":true,"consumer-restriction":true,"ua-restriction":true,"hmac-auth":true,"referer-restriction":true,"api-breaker":true,"limit-count":true,"loggly":true,"jwt-auth":true,"public-api":true,"openwhisk":true,"gzip":true,"syslog":true,"ext-plugin-pre-req":true,"request-id":true,"aws-lambda":true,"redirect":true,"client-control":true,"prometheus":true,"forward-auth":true,"http-logger":true,"kafka-logger":true,"udp-logger":true,"echo":true,"skywalking-logger":true,"response-rewrite":true,"traffic-split":true,"google-cloud-logging":true,"ip-restriction":true,"ldap-auth":true,"key-auth":true,"serverless-post-function":true,"zipkin":true,"proxy-rewrite":true,"ext-plugin-post-req":true,"serverless-pre-function":true,"clickhouse-logger":true,"tcp-logger":true,"authz-keycloak":true,"openid-connect":true,"uri-blocker":true,"real-ip":true,"opa":true,"proxy-control":true,"csrf":true,"basic-auth":true,"authz-casbin":true,"server-info":true,"proxy-mirror":true,"limit-conn":true,"limit-req":true,"sls-logger":true,"fault-injection":true,"azure-functions":true,"proxy-cache":true,"grpc-web":true,"mocking":true,"wolf-rbac":true,"datadog":true,"file-logger":true,"cors":true,"rocketmq-logger":true,"request-validation":true,"example-plugin":true}, context: init_worker_by_lua*
labindia01_apisix.1.l475yve866q8@xxxx    | 2022/05/09 09:44:03 [warn] 43#43: *3 [lua] plugin.lua:223: load_stream(): new plugins: {"limit-conn":true,"ip-restriction":true,"mqtt-proxy":true}, context: init_worker_by_lua*
labindia01_apisix.1.l475yve866q8@xxxx    | 2022/05/09 09:44:03 [warn] 47#47: *1 [lua] plugin.lua:223: load_stream(): new plugins: {"limit-conn":true,"ip-restriction":true,"mqtt-proxy":true}, context: init_worker_by_lua*
labindia01_apisix.1.l475yve866q8@xxxx    | 2022/05/09 09:44:03 [warn] 44#44: *2 [lua] plugin.lua:223: load_stream(): new plugins: {"limit-conn":true,"ip-restriction":true,"mqtt-proxy":true}, context: init_worker_by_lua*

As a matter of fact, apisix-dashboard and apisix containers can ping labindia01_etcd(hostname)

/usr/local/apisix-dashboard # ping labindia01_etcd
PING labindia01_etcd (10.0.32.212): 56 data bytes
64 bytes from 10.0.32.212: seq=0 ttl=64 time=0.223 ms
64 bytes from 10.0.32.212: seq=1 ttl=64 time=0.067 ms
64 bytes from 10.0.32.212: seq=2 ttl=64 time=0.081 ms
labindia01_apisix:/usr/local/apisix# ping labindia01_etcd
PING labindia01_etcd (10.0.32.212): 56 data bytes
64 bytes from 10.0.32.212: seq=0 ttl=64 time=0.079 ms
64 bytes from 10.0.32.212: seq=1 ttl=64 time=0.067 ms
64 bytes from 10.0.32.212: seq=2 ttl=64 time=0.068 ms
64 bytes from 10.0.32.212: seq=3 ttl=64 time=0.083 ms

However, when we define labindia01_etcd instead of container IP in config.yaml, apisix container doesnt come up.

etcd:
  host:                          
    - "http://10.0.32.212:2379"     
tzssangglass commented 2 years ago

hi @prajith-nair I think you can ref: https://github.com/qwxingzhe/apisix-docker-compose/pull/2 to solve your problem

tzssangglass commented 2 years ago

As a matter of fact, apisix-dashboard and apisix containers can ping labindia01_etcd(hostname)

domain name resolution with ping is different from that with APISIX.

prajith-nair commented 2 years ago

@tzssangglass - The changes suggested in https://github.com/qwxingzhe/apisix-docker-compose/pull/2/commits/355212182e0e334a8e51cd483819134e6a284c27 is already part of my configuration. Would you like to deploy using the docker-compose.yml file shared by me and give it a try.

Please be advised my setup uses overlay network as opposed to driver: bridge the one in https://github.com/qwxingzhe/apisix-docker-compose/pull/2/commits/355212182e0e334a8e51cd483819134e6a284c27#

tzssangglass commented 2 years ago

@tzssangglass - The changes suggested in qwxingzhe/apisix-docker-compose@3552121 is already part of my configuration. Would you like to deploy using the docker-compose.yml file shared by me and give it a try.

Please be advised my setup uses overlay network as opposed to driver: bridge the one in qwxingzhe/apisix-docker-compose@3552121

Unfortunately, I don't have enough machines to support building a docker overlay network.

@leslie-tsang Can you help with this?

github-actions[bot] commented 1 year ago

This issue has been marked as stale due to 350 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.

github-actions[bot] commented 1 year ago

This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.