STEPHANIE WONG: So hey, Ed, now for our Hipster Shop app,
we've got some basic services set up.
But my site is getting so popular, I need to do more.
ED HOFMANN: Istio can help with that too.
There are all kinds of advanced traffic management features
you can do to control your content.
STEPHANIE WONG: Great.
So does that mean that you're going
to show me how it works before my site becomes too mainstream?
ED HOFMANN: Sure thing.
Let's jump right into it.
[MUSIC PLAYING]
So right away, we're at Hipster Shop version one.
We can scroll through the web page.
We can click on products.
And we can figure out if we want to add them to our cart or not.
But right away, let's take a step back here.
Let's go back to our main page.
And let's figure out how we want to do
routing to our front ends.
So first, here, we'll run a command
to see the different front ends that we're running.
And you see right here, we're running
three different versions of our front end.
So what we'll do now is we'll take a look
at the virtual services that are running,
and we'll take a look to see what the front end
virtual service is actually doing
and how it's routing traffic currently.
So when we run this command, we'll
see here that all the traffic is being
routed to some subset of our pods known as version one.
Now what does V1 mean?
So here what we'll do is we'll take a look at the destination
rules.
And in particular, we'll take a look at the front end
destination rule to see what V1 means.
When we take a look at this, we see
that V1 relates to version one of our application,
V2 to version two, and V3 to version three,
a nice, simple way of keeping all this organized.
So right here, we have a user that's already on the web page.
So let's take a look at what we would
do to route this user's traffic to version two of the web page.
So this user has a shop session cookie,
so we'll apply that into our virtual service,
and we'll apply this YAML file.
And we'll go and we'll take a look at our web page.
We'll reload the page.
And we notice now that this user is currently being routed
to version two of the web page.
So we'll take this again link.
We'll go into an incognito window.
And we'll see what other users are seeing.
And you see right away that they're being routed
to version one of the web page.
So now that's great and all, but what
if we want to do some canary deployments or some 80-20
or traffic splitting between our different versions?
So the next thing we'll do is we'll
take a look at a YAML file, which shows us
what it would look like to spilt traffic 75% to version one
and 25% to version three for all users
who are currently not on the page.
So right here, it's just as simple as adding a weight
to the YAML file.
So we'll go ahead and apply this,
and then we'll go back and check on our web page.
So for the user that currently has a session ID,
we'll keep refreshing the page.
And if you notice here, it's still
being routed to version two of the website.
So now let's open another incognito window,
and let's see what's going on for what
all the other users see.
So you see right away that they're at Hipster Shop version
one.
If we reload the page a couple of times,
we should see about one in every four refresh
get routed to version three of the web page.
Now, this gives you a very simple way to route traffic
and do some splitting between your services.
And simple enough, that was traffic management with Istio.
STEPHANIE WONG: And it was as easy as that
to do weighted traffic distribution
to different versions of our app.
ED HOFMANN: Yeah.
Behind the scenes, Istio is doing all the routing and work,
making it super easy for dev ops.
Don't forget to like, comment, and subscribe
for our next episode on Istio.
STEPHANIE WONG: And if you'd like to get in contact with us,
click on the link in the description.
[MUSIC PLAYING]