測試環境版本:
> istio: 1.13.1
> kubernetes: v1.23.4
本篇延續上篇針對nrf進行容錯部署
金絲雀部署
上篇只有在remote cluster部署v2,要在primary cluster部署v1才有辦法進行金絲雀部署
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: free5gc-nrf-canary
spec:
hosts:
- free5gc-nrf-svc
http:
- route:
- destination:
host: free5gc-nrf-svc.5gc.svc.cluster.local
subset: v1
weight: 80
- destination:
host: free5gc-nrf-svc.5gc.svc.cluster.local
subset: v2
weight: 20
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: free5gc-nrf-canary
spec:
host: free5gc-nrf-svc.5gc.svc.cluster.local
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
熔斷
"free5gc-nrf-circuit-breaking.yaml" [noeol] 18L, 446C 1,1 All
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: free5gc-nrf-circuit-breaking
spec:
host: free5gc-nrf-svc.5gc.svc.cluster.local
trafficPolicy:
connectionPool:
tcp:
maxConnections: 1
http:
http1MaxPendingRequests: 1
maxRequestsPerConnection: 1
outlierDetection:
consecutive5xxErrors: 1
interval: 1s
baseEjectionTime: 3m
maxEjectionPercent: 100
重試
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: free5gc-nrf-retries
spec:
hosts:
- free5gc-nrf-svc
http:
- route:
- destination:
host: free5gc-nrf-svc.5gc.svc.cluster.local
retries:
attempts: 3
perTryTimeout: 1s
retryOn: 5xx,retriable-4xx