I'm quite new to istio and experimenting Istio circuit breaker concepts, for that I have configured the istio virtual service, destination rules and nginx pods.
My virtual service have two different nginx pods, I configured 50-50 traffic distribution, For testing the circuit breaker I scaled down my service B to zero, thought of expectation should route the traffic always to Service A. But It's not working a expected
I'm getting no healthy upstream error, whenever traffic routed to service B
Kindly find the configuration files for the same
Deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment-1
labels:
app: nginx-deployment-1
spec:
replicas: 1
selector:
matchLabels:
app: nginx
version: "1"
template:
metadata:
labels:
app: nginx
version: "1"
spec:
containers:
- name: nginx-1
image: nginx:latest
ports:
- containerPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment-2
labels:
app: nginx-deployment-2
spec:
replicas: 0
selector:
matchLabels:
app: nginx
version: "2"
template:
metadata:
labels:
app: nginx
version: "2"
spec:
containers:
- name: nginx-2
image: nginx:1.14.2
ports:
- containerPort: 80
VirtualService.yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: nginx-virtual-service
spec:
hosts:
- "*"
gateways:
- nginx-gateway
http:
- route:
- destination:
host: nginx-service
subset: v1
port:
number: 80
weight: 50
- destination:
host: nginx-service
subset: v2
port:
number: 80
weight: 50
# retries:
# attempts: 3
# perTryTimeout: 1s
# retryOn: 5xx
# timeout: 3s
**service.yaml**
apiVersion: v1
kind: Service
metadata:
name: nginx-service
labels:
app: nginx-service
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 80
protocol: TCP
name: http-web
selector:
app: nginx
destinationrule.yml
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: nginx-load-balancer
spec:
host: nginx-service
trafficPolicy:
connectionPool:
http:
http1MaxPendingRequests: 1
maxRequestsPerConnection: 1
tcp:
maxConnections: 1
outlierDetection:
baseEjectionTime: 60s
consecutive5xxErrors: 1
interval: 2s
maxEjectionPercent: 100
subsets:
- name: v1
labels:
version: "1"
- name: v2
labels:
version: "2"
I'm getting the below error while routing the traffic to service B, Since I scaled down that pod to zero for testing, Not sure circuit breaker will trip and block the service B request and send all traffic only to Service A
Anyone pls advise on this ?