Skip to content

bug: dns service discovery upstreams are not working in GKE #6732

Description

@ukanwat

Current Behavior

APISIX is throwing an error related to port being 0 when upstream has discovery_type "dns".
same exact setup works fine with clusters from other kubernetes providers.

Expected Behavior

Should not throw the error http_access_phase(): failed to set upstream: invalid nodes format: failed to validate item 1: property "port" validation failed: expected 0 to be at least 1

Error Logs

in web response -
503 Service Temporarily Unavailable
in apisix pod -
init.lua:520: http_access_phase(): failed to set upstream: invalid nodes format: failed to validate item 1: property "port" validation failed: expected 0 to be at least 1

Steps to Reproduce

  1. Create a standard Google Kubernetes Engine cluster.
  2. Install APISIX with ingress controller and dashboard via api7 helm chart version 0.8.4 using this values.yaml file (in ingress-apisix namespace).
  3. create this upstream via admin api - { "id": "398808046194655761", "create_time": 1647237719, "update_time": 1647237719, "timeout": { "connect": 6, "send": 6, "read": 6 }, "type": "roundrobin", "scheme": "http", "discovery_type": "dns", "pass_host": "node", "name": "apisix-dashboard", "service_name": "apisix-dashboard.ingress-apisix.svc.cluster.local", "keepalive_pool": { "idle_timeout": 60, "requests": 1000, "size": 320 } }
    4. create this route via admin api - {"id":"398808266596942353","create_time":1647237850,"update_time":1647441243,"uri":"/*","name":"apisix-dashboard","priority":50,"methods":["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS","CONNECT","TRACE"],"host":"apisix-dashboard.example.com","plugins":{"redirect":{"http_to_https":true}},"upstream_id":"398808046194655761","labels":{"API_VERSION":"v1"},"status":1}
    5. visit the host in the route and then check the logs in the apisix pod.

Environment

  • APISIX version (run apisix version): 2.12.1
  • Operating system (run uname -a): kubernetes (GKE)
    Rest of the values are whatever is bundled in apisix/apisix version 0.8.4 helm chart.
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions