此文档已经不再维护。您当前查看的是快照版本。如果想要查看最新版本的文档,请参阅最新版本。
DestinationRule
用来处理目标地址的规则,与DestinationRule
相关的ServiceEntry
, WorkloadEntry
等定义与开源保持一致
apiVersion: service.dubbo.apache.org/v1alpha1
kind: DestinationRule
metadata:
name: demo-route
spec:
host: demo
subsets:
trafficPolicy:
Field | Type | Description | Required |
---|---|---|---|
name | string | 规则的名字,方便识别规则用意 | YES |
host | string | 注册中心里面对应的key值,现在是接口名 | YES |
trafficPolicy | TrafficPolicy | 流量策略 | NO |
subsets | Subset[] | 服务的单一版本或多版本的命名 | YES |
Subset
应用服务的命名,可以是单个也可以是多个版本
apiVersion: service.dubbo.apache.org/v1alpha1
kind: DestinationRule
metadata:
name: demo-route
spec:
subsets: #Subnet[]
- name:
labels:
Field | Type | Description | Required |
---|---|---|---|
name | string | 服务版本名称 | YES |
labels | map<string, string> | 打在服务身上的标签 | YES |
TrafficPolicy
表示负载均衡策略
apiVersion: service.dubbo.apache.org/v1alpha1
kind: DestinationRule
metadata:
name: demo-route
spec:
trafficPolicy: #TrafficPolicy
loadBalancer:
Field | Type | Description | Required |
---|---|---|---|
loadBalancer | LoadBalancerSettings | 负载均衡设置 | YES |
LoadBalancerSettings
用来表示负载均衡相关的配置
apiVersion: service.dubbo.apache.org/v1alpha1
kind: DestinationRule
metadata:
name: demo-route
spec:
trafficPolicy:
loadBalancer: #LoadBalancerSettings
simple:
consistentHash:
Field | Type | Description | Required |
---|---|---|---|
simple | string | 负载均衡策略,其中包括:ROUND_ROBIN , LEAST_CONN , RANDOM , PASSTHROUGH | YES |
consistentHash | ConsistentHashLB | 一致性Hash策略(未实现) NO | |
NO |