Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Latest commit

 

History

History

smi-flagger

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Using Flagger

Setup

Prerequisite

  • kubectl installed.
  • Working Kubernetes cluster.

Install Istio

Download manifests as mentioned in upstream docs.

curl -L https://git.io/getLatestIstio | ISTIO_VERSION=1.1.6 sh -

Install Istio on Kubernetes

cd istio-1.1.6
kubectl apply -f install/kubernetes/istio-demo-auth.yaml

NOTE: Above apply might sometimes give errors like unable to recognize "install/kubernetes/istio-demo-auth.yaml": no matches for kind "DestinationRule" in version "networking.istio.io/v1alpha3", this is most likely because the CRDs are not registered yet and apiserver will reconcile it. Try running the above kubectl apply ... again.

Install SMI CRDs and Operator to work with Istio

cd $GOPATH/src/github.com/servicemeshinterface/smi-adapter-istio/docs/smi-flagger
kubectl apply -f https://raw.githubusercontent.com/servicemeshinterface/smi-adapter-istio/master/deploy/crds/crds.yaml
kubectl apply -f https://raw.githubusercontent.com/servicemeshinterface/smi-adapter-istio/master/deploy/operator-and-rbac.yaml

Install Flagger

kubectl apply -f manifests/00-install-flagger.yaml

Demo

Deploy v1 of Bookinfo application

kubectl create ns smi-demo
kubectl label namespace smi-demo istio-injection=enabled
kubectl -n smi-demo apply -f manifests/00-bookinfo-setup.yaml
kubectl -n smi-demo apply -f manifests/01-deploy-v1.yaml

Create the canary object

kubectl -n smi-demo apply -f manifests/02-canary.yaml

Verify the application works

Run following command to get the URL to acces the application.

echo "http://$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')/productpage"

It generally looks like following: http://52.168.69.51/productpage.

Visit above URL in the browser and you won't see any ratings since the reviews v1 does not call ratings service at all.

Deploy LoadTester

Deploy the load testing service to generate traffic during the canary analysis:

export REPO=https://raw.githubusercontent.com/weaveworks/flagger/master
kubectl -n smi-demo apply -f ${REPO}/artifacts/loadtester/deployment.yaml
kubectl -n smi-demo apply -f ${REPO}/artifacts/loadtester/service.yaml

Deploy v2 of reviews application

kubectl -n smi-demo set image deploy reviews reviews=istio/examples-bookinfo-reviews-v2:1.10.1

Once any changes are detected to the deployment it will be gradually scaled up. You can refresh the page to see that the traffic to new version is gradually increased.

Verify successful deployment of v2

Run following command to see that the deployment is progressing. Also meanwhile you can refresh browser to see that the traffic sent to version v2 of the reviews micro-service is increasing.

kubectl -n smi-demo describe canaries reviews

Once the output looks like following that means the newer version is successfully deployed. And all of the traffic will be sent to the newer version.

$ kubectl -n smi-demo get canaries
NAME      STATUS      WEIGHT   LASTTRANSITIONTIME
reviews   Succeeded   0        2019-05-16T14:45:15Z

Also you can observe that the TrafficSplit object is created.

kubectl get trafficsplit