Hi I’m trying to do canary deployment with istio traffic management. However, traffic was not split correctly but always went through one version. Looks like 0 vs 100 works but whatever other numbers didn’t do what expected. Could you help ? Thanks.
Here is my yaml
---
apiVersion: v1
kind: Service
metadata:
name: my-app
spec:
type: ClusterIP
ports:
- port: 443
targetPort: 9091
protocol: TCP
name: my-app
selector:
app: my-app
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app-v1
labels:
app: my-app
version: v1
spec:
replicas: 1
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
version: v1
---
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: my-app
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: my-app
minReplicas: 1
maxReplicas: 2
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: my-app
spec:
host: my-app.com
trafficPolicy:
loadBalancer:
simple: RANDOM
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: my-app-gateway
spec:
selector:
istio: ingressgateway
servers:
- port:
name: https
number: 443
protocol: HTTPS
tls:
mode: PASSTHROUGH
hosts:
- "my-app.com"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: my-app-virtual-service
spec:
gateways:
- my-app-gateway
hosts:
- my-app.com
tls:
- match:
- port: 443
sniHosts:
- my-app.com
route:
- destination:
host: my-app.com
port:
number: 443
subset: v1
weight: 50
- destination:
host: my-app.com
port:
number: 443
subset: v2
weight: 50```