Skip to content

antonioberben/test-in-production

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Control routing with Baggage header

Demo

In this demo, you will learn how to use the baggage header to control the routing of your services.

Architecture:

demo

Clone the repository

git clone git@github.com:antonioberben/test-in-production.git
cd test-in-production 

Deploy Istio

istioctl install -f ./k8s/istio-values.yaml -y

Deploy the services

kubectl create ns my-system

kubectl label namespace my-system istio.io/rev=1-21 --overwrite

kubectl apply -f ./k8s/app.yaml
kubectl apply -f ./k8s/app3-new-version.yaml

Deploy the Istio Resources

kubectl apply -f ./k8s/istio-virtualservice.yaml

Test the services

kubectl port-forward -n my-system svc/app1 5000

And then

curl localhost:5000/product/123

You will see the response from app1, app2 and app3 together:

Hello from API 1!
Hello from API 2!
Hello from API 3!

Now, adding the baggage header which will be propagated across the services:

curl localhost:5000/product/123 -H "baggage: pr=123"

You will see the response from app3 with the blue version:

Hello from API 1!
Hello from API 2!
Hello from API 3! This is a new version of the app

Checking the logs for the proxy,

kubectl logs -n my-app deploy/app3 -n my-system -c istio-proxy --tail 1

You will see outputted the baggage header that was passed to the application. Notice that app1 added some extra baggage.

[ACCES_LOGS] "baggage": "x=1,pr=123,product-id=123,other-baggage=value2,another-baggage=3,url-baggage=%2Ftest%2F1%3Fattr%3D1" "authority": "app3.my-system.svc.cluster.local:5000" "method": "GET" "path": "/"

Interesting links

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published