背景
istio dns proxy可以用于提升dns解析性能和可用性
介紹
cni模式(無需設(shè)置CAPTURE_ALL_DNS)
- istiod設(shè)置PILOT_ENABLE_IP_AUTOALLOCATE: "true"環(huán)境變量
- 開啟dns proxy
針對全局,設(shè)置istiod configmap中的proxyMetadata,添加
ISTIO_META_DNS_CAPTURE: "true"
針對部分,設(shè)置pod注解,添加
annotations:
proxy.istio.io/config: |
proxyMetadata:
ISTIO_META_DNS_CAPTURE: "true"
非cni模式
- istiod設(shè)置PILOT_ENABLE_IP_AUTOALLOCATE: "true"環(huán)境變量
- 開啟dns proxy
針對全局,設(shè)置istiod configmap中的proxyMetadata,添加
CAPTURE_ALL_DNS: "true"
ISTIO_META_DNS_CAPTURE: "true"
針對部分,設(shè)置pod注解,添加
annotations:
proxy.istio.io/config: |
proxyMetadata:
CAPTURE_ALL_DNS: "true"
ISTIO_META_DNS_CAPTURE: "true"
補充
為什么不使用ISTIO_META_DNS_AUTO_ALLOCATE
ISTIO_META_DNS_AUTO_ALLOCATE分配serviceentry的address不穩(wěn)定,需要改為設(shè)置istiod的PILOT_ENABLE_IP_AUTOALLOCATE
如果需要創(chuàng)建serviceentry
- serviceentry放在一個沒有pod的namespace中,設(shè)置exportTo: '.'
- 等待erviceentry分配出status.addresses,修改exportTo: '*'
原因:
controller 給serviceentry分配status.addresses是有時間窗口的,如果直接將serviceentry exportTo給其他pod,可能會引入流量路由問題