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:
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
apiVersion: v1
kind: Endpoints
name: plat-dev
namespace: default
subsets:
- ip: "10.5.10.109"
ports:
a nodes(“default/plat-dev:3306”) call will get follow result: