前言
主管挑戰DC失敗,變成又要變回舊的系統架構。暈…
用了istio是為了一個ip打所有服務,現在又變回去。
服務跟 ip 是一對一的存在。所以,如果用istio的預設安裝,只會安裝一個。
現在要變成多個。
正文
最簡單的安裝方式,可看前一篇 [ISTIO] ISTIO 安裝及使用
以前新增的時候,都會同時安裝最原始的deploy 以及 service(fig.1),
(fig.1)
所以在新增新的ingressgateway的時候,需要先指定原始的istio-ingressgateway 為 enable:false。
這樣在安裝的時候,才不會同時安裝。
kind: IstioOperator
apiVersion: install.istio.io/v1alpha1
metadata:
annotations:
install.istio.io/ignoreReconcile: 'true'
name: istio-external-test
namespace: istio-system
spec:
addonComponents:
istiocoredns:
enabled: false
components:
base:
enabled: true
cni:
enabled: false
ingressGateways:
- name: istio-ingressgateway # 20210730新增,可取消單獨佈署此yaml還會額外裝ingress-gateway
enabled: false
- name: ingressgateway-external
namespace: istio-system
enabled: true
k8s:
service:
# loadBalancerIP 要跟著改,最好先將IP設成靜態
loadBalancerIP:
loadBalancerSourceRanges:
# - 0.0.0.0/0
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
env:
- name: ISTIO_META_ROUTER_MODE
value: standard
hpaSpec:
minReplicas: 1
overlays:
- kind: HorizontalPodAutoscaler
name: ingressgateway-external
patches:
- path: metadata.labels.app
value: ingressgateway-external
- path: metadata.labels.istio
value: ingressgateway-external
- path: spec.scaleTargetRef.name
value: ingressgateway-external
- kind: Deployment
name: ingressgateway-external
patches:
- path: metadata.labels.app
value: ingressgateway-external
- path: metadata.labels.istio
value: ingressgateway-external
- path: spec.selector.matchLabels.app
value: ingressgateway-external
- path: spec.selector.matchLabels.istio
value: ingressgateway-external
- path: spec.template.metadata.labels.app
value: ingressgateway-external
- path: spec.template.metadata.labels.istio
value: ingressgateway-external
- kind: Service
name: ingressgateway-external
patches:
- path: metadata.labels.app
value: ingressgateway-external
- path: metadata.labels.istio
value: ingressgateway-external
- path: spec.selector.app
value: ingressgateway-external
- path: spec.selector.istio
value: ingressgateway-external
- kind: PodDisruptionBudget
name: ingressgateway-external
patches:
- path: metadata.name
value: ingressgateway-external
- path: metadata.labels.app
value: ingressgateway-external
- path: metadata.labels.istio
value: ingressgateway-external
- path: spec.selector.matchLabels.app
value: ingressgateway-external
- path: spec.selector.matchLabels.istio
value: ingressgateway-external
0 意見:
張貼留言