mirror of https://github.com/istio/istio.io.git
21 lines
14 KiB
HTML
21 lines
14 KiB
HTML
<!DOCTYPE html><html lang="en" itemscope itemtype="https://schema.org/WebPage"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="title" content="Traffic mirroring with Istio for testing in production"><meta name="og:title" content="Traffic mirroring with Istio for testing in production"><meta name="og:image" content="/v0.5/img/logo.png"/><meta name="theme-color" content="#466BB0"/><meta name="description" content="An introduction to safer, lower-risk deployments and release to production"><meta name="og:description" content="An introduction to safer, lower-risk deployments and release to production"><title>Istioldie 0.5 / Traffic mirroring with Istio for testing in production</title><script> window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date; ga('create', 'UA-98480406-2', 'auto'); ga('send', 'pageview'); </script> <script async src='https://www.google-analytics.com/analytics.js'></script><link rel="alternate" type="application/rss+xml" title="Istio Blog RSS" href="/v0.5/feed.xml"><link rel="shortcut icon" href="/v0.5/favicons/favicon.ico" ><link rel="apple-touch-icon" href="/v0.5/favicons/apple-touch-icon-180x180.png" sizes="180x180"><link rel="icon" type="image/png" href="/v0.5/favicons/favicon-16x16.png" sizes="16x16"><link rel="icon" type="image/png" href="/v0.5/favicons/favicon-32x32.png" sizes="32x32"><link rel="icon" type="image/png" href="/v0.5/favicons/android-36x36.png" sizes="36x36"><link rel="icon" type="image/png" href="/v0.5/favicons/android-48x48.png" sizes="48x48"><link rel="icon" type="image/png" href="/v0.5/favicons/android-72x72.png" sizes="72x72"><link rel="icon" type="image/png" href="/v0.5/favicons/android-96x196.png" sizes="96x196"><link rel="icon" type="image/png" href="/v0.5/favicons/android-144x144.png" sizes="144x144"><link rel="icon" type="image/png" href="/v0.5/favicons/android-192x192.png" sizes="192x192"><link rel="manifest" href="/v0.5/manifest.json"><meta name="apple-mobile-web-app-title" content="Istio"><meta name="application-name" content="Istio"><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic"><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"><link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.6/css/all.css"><link rel="stylesheet" href="/v0.5/css/light_theme.css" title="light"><link rel="alternate stylesheet" href="/v0.5/css/dark_theme.css" title="dark"> <script src="/v0.5/js/styleswitcher.js"></script></head><body class="language-unknown theme-unknown"><header role="banner"><nav class="navbar navbar-expand-sm navbar-dark fixed-top bg-dark"> <a class="navbar-brand d-flex w-50 mr-auto" href="/v0.5/" style="visibility: visible"> <img class="logo" src="/v0.5/img/istio-logo.svg" alt="Istio Logo"/> <span class="brand-name">Istioldie 0.5</span> </a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button><div class="collapse navbar-collapse" id="navbarCollapse"><div class="navbar-nav justify-content-end"> <a class="nav-item nav-link " href="/v0.5/about/intro.html">About</a> <a class="nav-item nav-link active" href="/v0.5/blog/2018/traffic-mirroring.html">Blog</a> <a class="nav-item nav-link " href="/v0.5/docs/">Docs</a> <a class="nav-item nav-link " href="/v0.5/help">Help</a> <a class="nav-item nav-link " href="/v0.5/community">Community</a></div><div class="dropdown"> <a href="" class="nav-link nav-item dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class='fa fa-lg fa-cog'></i> </a><div class="dropdown-menu"><h6 class="dropdown-header">Other versions of this site</h6><li> <a href="https://istio.io">Current Release</a></li><li> <a href="https://preliminary.istio.io">Next Release</a></li><li> <a href="https://archive.istio.io">Older Releases</a></li><li class="dropdown-divider"></li><li> <i class='fa fa-check light'></i> <a href="" onclick="setActiveStyleSheet('light');return false;">Light Theme</a></li><li> <i class='fa fa-check dark'></i> <a href="" onclick="setActiveStyleSheet('dark');return false;">Dark Theme</a></li></div></div><form name="cse" id="searchbox" class="form-inline justify-content-end" role="search"> <input type="hidden" name="cx" value="013699703217164175118:iwwf17ikgf4" /> <input type="hidden" name="ie" value="utf-8" /> <input type="hidden" name="hl" value="en" /><div class="input-group"> <input name="q" class="form-control search-box" type="text" size="30" /> <button class="btn btn-search input-group-addon my-2 my-sm-0 fa fa-search" type="submit"></button></div></form></div></nav></header><div class="container-fluid blog"><div class="row row-offcanvas row-offcanvas-left"><div class="col-6 col-md-3 col-xl-2 sidebar-offcanvas"><nav class="sidebar"><div class="spacer"></div><div class="directory" role="tablist"><div class="card"><div class="card-header" role="tab" id="header1"> <a data-toggle="collapse" href="#collapse1" title="Blog posts for 2018" role="button" aria-controls="collapse1"><div> 2018 Posts</div></a></div><div id="collapse1" class="collapse show" data-parent="#sidebar" role="tabpanel" aria-labelledby="header1"><div class="card-body"><ul class="tree"><li> <span class="current" title="An introduction to safer, lower-risk deployments and release to production">Traffic mirroring with Istio for testing in production</span></li><li> <a title="Describes a simple scenario based on Istio Bookinfo sample" href="/v0.5/blog/2018/egress-tcp.html">Consuming External TCP Services</a></li><li> <a title="Describes a simple scenario based on Istio Bookinfo sample" href="/v0.5/blog/2018/egress-https.html">Consuming External Web Services</a></li></ul></div></div></div><div class="card"><div class="card-header" role="tab" id="header5"> <a data-toggle="collapse" href="#collapse5" title="Blog posts for 2017" role="button" aria-controls="collapse5"><div> 2017 Posts</div></a></div><div id="collapse5" class="collapse" data-parent="#sidebar" role="tabpanel" aria-labelledby="header5"><div class="card-body"><ul class="tree"><li> <a title="Improving availability and reducing latency" href="/v0.5/blog/2017/mixer-spof-myth.html">Mixer and the SPOF Myth</a></li><li> <a title="Provides an overview of the Mixer plug-in architecture" href="/v0.5/blog/2017/adapter-model.html">Mixer Adapter Model</a></li><li> <a title="Istio 0.2 announcement" href="/v0.5/blog/2017/0.2-announcement.html">Announcing Istio 0.2</a></li><li> <a title="How Kubernetes Network Policy relates to Istio policy" href="/v0.5/blog/2017/0.1-using-network-policy.html">Using Network Policy with Istio</a></li><li> <a title="Using Istio to create autoscaled canary deployments" href="/v0.5/blog/2017/0.1-canary.html">Canary Deployments using Istio</a></li><li> <a title="Istio Auth 0.1 announcement" href="/v0.5/blog/2017/0.1-auth.html">Using Istio to Improve End-to-End Security</a></li><li> <a title="Istio 0.1 announcement" href="/v0.5/blog/2017/0.1-announcement.html">Introducing Istio</a></li></ul></div></div></div><div class="text-center" style="margin-top: 1em; font-size: 1.2em;" > <a href="/v0.5/feed.xml"> <img style="width: 1.4em;" src="/v0.5/img/rss.svg" alt="RSS"/> Subscribe </a></div></div></nav></div><div class="col-12 col-md-9 col-lg-7 col-xl-8"><p class="d-md-none"> <label class="sidebar-toggler" data-toggle="offcanvas"> <i class="fa fa-chevron-right"></i> </label></p><main role="main"><h1>Traffic mirroring with Istio for testing in production</h1><p class="subtitle">Routing rules for HTTP traffic</p><p class="byline"> By <span class="attribution">Christian Posta</span> / <span class="publish_date">February 8, 2018</span></p><p>Trying to enumerate all the possible combinations of test cases for testing services in non-production/test environments can be daunting. In some cases, you’ll find that all of the effort that goes into cataloging these use cases doesn’t match up to real production use cases. Ideally, we could use live production use cases and traffic to help illuminate all of the feature areas of the service under test that we might miss in more contrived testing environments.</p><p>Istio can help here. With the release of <a href="/v0.5/about/notes/0.5.html">Istio 0.5.0</a>, Istio can mirror traffic to help test your services. You can write route rules similar to the following to enable traffic mirroring:</p><div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">apiVersion</span><span class="pi">:</span> <span class="s">config.istio.io/v1alpha2</span>
|
||
<span class="na">kind</span><span class="pi">:</span> <span class="s">RouteRule</span>
|
||
<span class="na">metadata</span><span class="pi">:</span>
|
||
<span class="na">name</span><span class="pi">:</span> <span class="s">mirror-traffic-to-httbin-v2</span>
|
||
<span class="na">spec</span><span class="pi">:</span>
|
||
<span class="na">destination</span><span class="pi">:</span>
|
||
<span class="na">name</span><span class="pi">:</span> <span class="s">httpbin</span>
|
||
<span class="na">precedence</span><span class="pi">:</span> <span class="s">11</span>
|
||
<span class="na">route</span><span class="pi">:</span>
|
||
<span class="pi">-</span> <span class="na">labels</span><span class="pi">:</span>
|
||
<span class="na">version</span><span class="pi">:</span> <span class="s">v1</span>
|
||
<span class="na">weight</span><span class="pi">:</span> <span class="s">100</span>
|
||
<span class="pi">-</span> <span class="na">labels</span><span class="pi">:</span>
|
||
<span class="na">version</span><span class="pi">:</span> <span class="s">v2</span>
|
||
<span class="na">weight</span><span class="pi">:</span> <span class="s">0</span>
|
||
<span class="na">mirror</span><span class="pi">:</span>
|
||
<span class="na">name</span><span class="pi">:</span> <span class="s">httpbin</span>
|
||
<span class="na">labels</span><span class="pi">:</span>
|
||
<span class="na">version</span><span class="pi">:</span> <span class="s">v2</span>
|
||
</code></pre></div></div><p>A few things to note here:</p><ul><li>When traffic gets mirrored to a different service, that happens outside the critical path of the request</li><li>Responses to any mirrored traffic is ignored; traffic is mirrored as “fire-and-forget”</li><li>You’ll need to have the 0-weighted route to hint to Istio to create the proper Envoy cluster under the covers; <a href="https://github.com/istio/istio/issues/3270">this should be ironed out in future releases</a>.</li></ul><p>Learn more about mirroring by visiting the <a href="/v0.5/docs/tasks/traffic-management/mirroring.html">Mirroring Task</a> and see a more <a href="http://blog.christianposta.com/microservices/traffic-shadowing-with-istio-reduce-the-risk-of-code-release/">comprehensive treatment of this scenario on my blog</a>.</p></main></div><div class="col-12 col-md-2 d-none d-lg-block"><nav class="toc"><div class="spacer"></div><div class="directory" role="directory"></div></nav></div></div></div><div class="footer"><footer><div class="container-fluid"><div class="row"><div class="col-sm-2"></div><nav class=" col-12 col-sm-3" role="navigation"><ul class="first"><li><a class="header" href="/v0.5/docs">Docs</a></li><li><a href="/v0.5/docs/concepts">Concepts</a></li><li><a href="/v0.5/docs/setup">Setup</a></li><li><a href="/v0.5/docs/tasks">Tasks</a></li><li><a href="/v0.5/docs/guides">Guides</a></li><li><a href="/v0.5/docs/reference">Reference</a></li></ul></nav><nav class="col-12 col-sm-3" role="navigation"><ul><li><a class="header" href="/v0.5/help">Help</a></li><li><a href="/v0.5/help/faq.html">FAQ</a></li><li><a href="/v0.5/help/glossary.html">Glossary</a></li><li><a href="/v0.5/help/troubleshooting.html">Troubleshooting</a></li><li><a href="/v0.5/help/bugs.html">Report Bugs</a></li><li><a href="https://github.com/istio/istio.github.io/issues/new?title=Issue with _blog/2018/traffic-mirroring.md" target="_blank" rel="noopener">Doc Bugs & Gaps</a></li><li><a href="https://github.com/istio/istio.github.io/edit/master/_blog/2018/traffic-mirroring.md" target="_blank" rel="noopener">Edit This Page</a></li></ul></nav><nav class="col-12 col-sm-3" role="navigation"><ul><li><a class="header" href="/v0.5/community">Community</a></li><li> <a href="https://groups.google.com/forum/#!forum/istio-users" target="_blank" rel="noopener">User</a> | <a href="https://groups.google.com/forum/#!forum/istio-dev" target="_blank" rel="noopener">Dev Mailing Lists</a></li><li><a href="https://twitter.com/IstioMesh" target="_blank" rel="noopener">Twitter</a></li><li><a href="https://stackoverflow.com/questions/tagged/istio" target="_blank" rel="noopener">Stack Overflow</a></li><li><a href="https://github.com/istio/community" target="_blank" rel="noopener">GitHub</a></li><li><a href="https://github.com/istio/community/blob/master/WORKING-GROUPS.md" target="_blank" rel="noopener">Working Groups</a></li></ul></nav></div><div class="row"><div class="col-12"><p class="description text-center" role="contentinfo"> Istio 0.5, Copyright © 2018 Istio Authors<br> Archived on 14-Feb-2018</p></div></div></div></footer></div><script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js"></script> <script src="https://www.google.com/cse/brand?form=searchbox"></script> <script src="/v0.5/js/misc.js"></script></body></html>
|