DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Kubernetes Rolling Updates Are Lying to You — and Your Users Are Paying for It
  • Java 27 Makes G1 the Default Everywhere: How to Test Your Small Containers Before You Upgrade
  • A Non-Expiring AKS Deployment Token Could Read Secrets Across Three Namespaces
  • Node and Capacity Spillover: What Happens When Kubernetes Runs Out of Room

Trending

  • How to Submit a Post to DZone
  • DZone's Article Submission Guidelines
  • When to Use AMQP, JMS, Kafka, or MQTT: Trade-Offs, Not a Winner
  • Kafka vs Flink vs Spark: Do You Really Need Real-Time?

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. A/B Testing With Kubernetes and Istio

A/B Testing With Kubernetes and Istio

See how you can use Kubernetes and Istio together to implement A/B testing in your app so that you can measure user response and make the best decisions.

By 
Niklas Heidloff
·
Feb. 20, 18 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
9.6K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

last week i gave a presentation “ when to use serverless? when to use kubernetes? ” one of the weaknesses of serverless platforms is that you currently cannot do things like a/b testing well since there is no notion of versions.

a/b testing allows running multiple variants of functionality in parallel, so that through analytics of user behavior, the better variant can be determined. similar to ‘dark launches,’ new features can be made available to only certain users to test features in production environments before these features will be released to the masses.

these traffic flow management capabilities are one of the advantages of kubernetes and istio . istio is an open platform to manage microservices.

some of my colleagues have documented how to do traffic flow management with istio for the book info sample that is part of the istio documentation . the current documentation is for istio 0.1.6 and doesn’t work for the later version 0.5.0, which i use. i’ve sent a pull request , since some urls have changed.

the diagram shows the architecture of the book info sample app. books have reviews and can have ratings. the application has three versions of the review service. the gray components on the left-hand side are the istio components. when the sample application is deployed, further istio components, the envoy containers, are automatically added to each pod. these envoy components are proxies (also called sidecars) through which containers communicate with each other which is the basis for istio’s traffic management capabilities.

istio-sample-architecture

check out the bookinfo.yaml file to see how to define and deploy the three versions of the review service.

in order to route traffic to version 1 for 50% of the invocations and to version 3 for the other half, this route rule can be used.

apiversion: config.istio.io/v1alpha2
kind: routerule
metadata:
  name: reviews-default
spec:
  destination:
    name: reviews
  precedence: 1
  route:
  - labels:
      version: v1
    weight: 50
  - labels:
      version: v3
    weight: 50


in order to expose version 2 to only users with the name ‘jason’, a regular expression can be used.

apiversion: config.istio.io/v1alpha2
kind: routerule
metadata:
  name: reviews-test-v2
spec:
  destination:
    name: reviews
  precedence: 2
  match:
    request:
      headers:
        cookie:
          regex: "^(.*?;)?(user=jason)(;.*)?$"
  route:
  - labels:
      version: v2


to learn more about traffic management in istio, check out the documentation . if you want to try out kubernetes, you can get an account on the ibm cloud .
Kubernetes A/B testing

Published at DZone with permission of Niklas Heidloff. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Kubernetes Rolling Updates Are Lying to You — and Your Users Are Paying for It
  • Java 27 Makes G1 the Default Everywhere: How to Test Your Small Containers Before You Upgrade
  • A Non-Expiring AKS Deployment Token Could Read Secrets Across Three Namespaces
  • Node and Capacity Spillover: What Happens When Kubernetes Runs Out of Room

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook