Closed prajith-nair closed 1 year 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.
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"
hi @prajith-nair I think you can ref: https://github.com/qwxingzhe/apisix-docker-compose/pull/2 to solve your problem
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.
@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 - 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?
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.
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.
Current Behavior
apisix_conf/config.yaml
etcd.conf.yml :
docker-compose.yml
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
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 being hostname of container (labindia01_etcd) should resolve in apisix
After
Error Logs
Steps to Reproduce
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
Check docker service log labindia01_apisix for potential errors
Environment
apisix version
): apisix:2.13.1uname -a
): Darwin prajith 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:47:26 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T8101 arm64openresty -V
ornginx -V
): nginx version: openresty/1.19.9.1 built by clang 13.1.6 (clang-1316.0.21.2.3) built with OpenSSL 1.1.1n 15 Mar 2022 TLS SNI support enabledcurl http://127.0.0.1:9090/v1/server_info
): etcdctl version: 3.5.4 API version: 3.5@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
luarocks --version
): 3.8.0