A/B testing with Istio — routing by headers, cookies, user-agent.
VirtualService (header-based):
1apiVersion: networking.istio.io/v1beta12kind: VirtualService3metadata:4 name: myapp5spec:6 hosts:7 - myapp8 http:9 - match:10 - headers:11 x-ab-test:12 exact: "variant-b"13 route:14 - destination:15 host: myapp16 subset: variant-b17 - match:18 - headers:19 x-user-group:20 exact: "beta-testers"21 route:22 - destination:23 host: myapp24 subset: variant-b25 - route:26 - destination:27 host: myapp28 subset: variant-a29 weight: 9030 - destination:31 host: myapp32 subset: variant-b33 weight: 10
Cookie-based:
1match:2 - headers:3 cookie:4 regex: ".*ab_test=variant-b.*"
Analysis with Prometheus:
1apiVersion: argoproj.io/v1alpha12kind: AnalysisTemplate3metadata:4 name: ab-test-analysis5spec:6 metrics:7 - name: conversion-rate8 interval: 5m9 count: 1210 successCondition: result[0] > 0.0211 provider:12 prometheus:13 address: http://prometheus:909014 query: |15 sum(rate(orders_total{variant="variant-b"}[5m])) /16 sum(rate(requests_total{variant="variant-b"}[5m]))
Monitoring: Grafana dashboard with breakdown by variant, Kiali for traffic visualization.