Skip to content

help request: about discovery kubernetes multi-cluster mode #12479

Description

@dxq6888

Description

apisix:
  node_listen: 9080
  enable_ipv6: false

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

nginx_config:
  error_log_level: debug

discovery:
  kubernetes:
  - id: prod1
    service:
      schema: https
      host: "a.example.com"
      port: "443"
    client:
      token: |-
        xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    default_weight: 50
    namespace_selector:
      match:
        - ".*"
    shared_size: 1m
    watch_endpoint_slices: false
  - id: prod2
    service:
      schema: https
      host: "b.example.com"
      port: "443"
    client:
      token: |-
        xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    default_weight: 50
    namespace_selector:
      match:
        - ".*"
    shared_size: 1m
    watch_endpoint_slices: false 

deployment:
  admin:
    allow_admin:  
      - 0.0.0.0/0

    admin_key:
      - name: "admin"
        key: edd1c9f034335f136f87ad84b625c8f1
        role: admin

      - name: "viewer"
        key: 4054f7cf07e344346cd3f287985e76a2
        role: viewer

  etcd:
    host:
      - "http://etcd:2379"
    prefix: "/apisix"     
    timeout: 30

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

The above is my apisix configuration file. I am doing automatic discovery for multiple k8s clusters, but following the above configuration will result in the following error

docker logs -f 42aa972214e6
/usr/local/openresty//luajit/bin/luajit ./apisix/cli/apisix.lua init
failed to read local yaml config of apisix: invalid discovery kubernetes configuration: object matches none of the required
/usr/local/openresty//luajit/bin/luajit ./apisix/cli/apisix.lua init
failed to read local yaml config of apisix: invalid discovery kubernetes configuration: object matches none of the required
/usr/local/openresty//luajit/bin/luajit ./apisix/cli/apisix.lua init
failed to read local yaml config of apisix: invalid discovery kubernetes configuration: object matches none of the required
/usr/local/openresty//luajit/bin/luajit ./apisix/cli/apisix.lua init
failed to read local yaml config of apisix: invalid discovery kubernetes configuration: object matches none of the required

If only one cluster is ok, as configured below

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

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

nginx_config:
  error_log_level: debug

discovery:
  kubernetes:
  - id: prod1
    service:
      schema: https
      host: "a.example.com"
      port: "443"
    client:
      token: |-
        xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    default_weight: 50
    namespace_selector:
      match:
        - ".*"
    shared_size: 1m
    watch_endpoint_slices: false

deployment:
  admin:
    allow_admin:  
      - 0.0.0.0/0

    admin_key:
      - name: "admin"
        key: edd1c9f034335f136f87ad84b625c8f1
        role: admin

      - name: "viewer"
        key: 4054f7cf07e344346cd3f287985e76a2
        role: viewer

  etcd:
    host:
      - "http://etcd:2379"
    prefix: "/apisix"     
    timeout: 30

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

I would like to know if there is a problem with my configuration or if Apisix does not support automatic discovery of services in multiple Kubernetes clusters

Environment

  • APISIX version (run apisix version):
  • Operating system (run uname -a):
  • 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

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    Status
    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions