Kubernetes

    A detailed configuration for the kubernetes service discovery is as follows:

    If the kubernetes service discovery runs inside a pod, you can use minimal configuration:

    1. kubernetes: { }

    If the kubernetes service discovery runs outside a pod, you need to create or select a specified ServiceAccount, then get its token value, and use following configuration:

    the kubernetes service discovery provides a query interface in accordance with the APISIX Discovery Specification

    description: \ nodes() function attempts to look up the ngx.shared.kubernetes for nodes corresponding to servicename, \ service_name should match pattern: [namespace]/[name]:[portName]_

    • namespace: The namespace where the kubernetes endpoints is located

    • name: The name of the kubernetes endpoints

    1. apiVersion: v1
    2. kind: Endpoints
    3. name: plat-dev
    4. namespace: default
    5. subsets:
    6. - ip: "10.5.10.109"
    7. ports:

    a nodes(“default/plat-dev:3306”) call will get follow result: