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
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Self-Hosted Inference Doesn’t Have to Be a Nightmare: How to Use GPUStack
  • Smart Deployment Strategies for Modern Applications
  • How We Diagnosed a Hidden Scheduler Failure in a Docker Swarm Cluster Serving 2 Million Users
  • Mastering Kubernetes to Maximize Your Cloud Potential

Trending

  • The ORM Is Over: AI-Written SQL Is the New Data Access Layer
  • Integrating AI-Driven Decision-Making in Agile Frameworks: A Deep Dive into Real-World Applications and Challenges
  • Liquibase: Database Change Management and Automated Deployments
  • The Death of "Text-Only" ChatOps: Why Google's A2UI Matters for DevOps and SRE
  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 user avatar
Niklas Heidloff
·
Feb. 20, 18 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
9.4K Views

Join the DZone community and get the full member experience.

Join For Free

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

  • Self-Hosted Inference Doesn’t Have to Be a Nightmare: How to Use GPUStack
  • Smart Deployment Strategies for Modern Applications
  • How We Diagnosed a Hidden Scheduler Failure in a Docker Swarm Cluster Serving 2 Million Users
  • Mastering Kubernetes to Maximize Your Cloud Potential

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • 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