Install required dependencies:
brew install kind kubectl helm watch
Create kind cluster:
kind create cluster --name flagger-demo --config cluster-config.yaml
Add Helm repository:
helm repo add metrics-server https://kubernetes-sigs.github.io/metrics-server/
Deploy Metrics Server:
helm upgrade metrics-server metrics-server/metrics-server \
--install \
--namespace kube-system \
--set args={--kubelet-insecure-tls}
Download Istio release:
curl -L https://istio.io/downloadIstio | ISTIO_VERSION=1.15.3 sh -
Add istioctl
binary to the system path:
sudo mv ./istio-1.15.3/bin/istioctl /usr/local/bin/
Deploy Istio control plane:
istioctl manifest install --set profile=default
Deploy Prometheus addon:
kubectl -n istio-system apply -f ./istio-1.15.3/samples/addons/prometheus.yaml
Deploy Grafana addon:
kubectl -n istio-system apply -f ./istio-1.15.3/samples/addons/grafana.yaml
Deploy Kiali addon:
kubectl -n istio-system apply -f ./istio-1.15.3/samples/addons/kiali.yaml
Add Helm repository:
helm repo add flagger https://flagger.app
Install Flagger CRDs:
kubectl apply -f https://raw.githubusercontent.com/fluxcd/flagger/main/artifacts/flagger/crd.yaml
Deploy Flagger for Istio:
helm upgrade flagger flagger/flagger \
--install \
--namespace=istio-system \
--set crd.create=false \
--set meshProvider=istio \
--set metricsServer=http://prometheus:9090
Create namespace with Istio proxy-injection enabled:
kubectl create ns test
kubectl label namespace test istio-injection=enabled
Deploy sample application:
kubectl -n test apply -k https://github.com/fluxcd/flagger//kustomize/podinfo?ref=main
Clone repository:
git clone https://github.com/openrca/orca-testapps.git
Deploy Fortio:
helm install fortio ./orca-testapps/fortio --namespace test
Add Helm repository:
helm repo add chaos-mesh https://charts.chaos-mesh.org
Deploy Chaos Mesh:
helm upgrade chaos-mesh chaos-mesh/chaos-mesh \
--version 2.4.2 \
--install \
--namespace=chaos \
--create-namespace \
--set chaosDaemon.runtime=containerd \
--set chaosDaemon.socketPath=/run/containerd/containerd.sock \
--set dashboard.create=true \
--set dashboard.securityMode=false
Port-forward Grafana:
kubectl -n istio-system port-forward svc/grafana 3000
Port-forward Kiali:
kubectl -n istio-system port-forward svc/kiali 20001
Port-forward Fortio:
kubectl -n test port-forward svc/fortio 8082
Setup watch on test application Deployments:
watch kubectl -n test get deploy
Setup watch on test application Pods:
watch kubectl -n test get pods
Setup watch on test application Services:
watch kubectl -n test get svc
Setup watch on canary events:
kubectl -n test get events \
--watch \
--field-selector involvedObject.kind=canary \
--field-selector involvedObject.name=podinfo |grep canary/podinfo
Setup watch on Istio configuration for test application service:
watch 'kubectl -n test describe vs podinfo |grep Spec -A 50'
-
Create canary configuration:
kubectl -n test apply -f ./canary-demo.yaml
-
Inspect created resources (Deployments, Services, Istio configuration).
-
Port-forward test application:
kubectl -n test port-forward svc/podinfo 9898
-
Ensure the test application is working.
-
Generate traffic to test application using Fortio web interface:
-
Check service graph in Kiali.
-
Check service metrics in Grafana.
-
Trigger canary deployment by updating the container image:
kubectl -n test set image deployment/podinfo \ podinfod=ghcr.io/stefanprodan/podinfo:6.0.1
-
Check service graph in Kiali:
-
Check service metrics in Grafana:
-
Observe canary processing in terminal:
New revision detected! Scaling up podinfo.test Starting canary analysis for podinfo.test Advance podinfo.test canary weight 10 Advance podinfo.test canary weight 20 Advance podinfo.test canary weight 30 Advance podinfo.test canary weight 40 Advance podinfo.test canary weight 50 Copying podinfo.test template spec to podinfo-primary.test Routing all traffic to primary Promotion completed! Scaling down podinfo.test
-
Trigger canary deployment by updating the container image:
kubectl -n test set image deployment/podinfo \ podinfod=ghcr.io/stefanprodan/podinfo:6.0.2
-
Wait until Flagger shifts portion of the traffic to the canary:
New revision detected! Scaling up podinfo.test Starting canary analysis for podinfo.test Advance podinfo.test canary weight 10
-
Generate traffic to application endpoint responding with
500 Internal Error
: -
Check service graph in Kiali:
-
Check service metrics in Grafana:
-
Observe canary processing in terminal:
New revision detected! Scaling up podinfo.test Starting canary analysis for podinfo.test Advance podinfo.test canary weight 10 Advance podinfo.test canary weight 20 Halt advancement no values found for istio metric request-duration probably podinfo.test is not receiving traffic Halt advancement no values found for istio metric request-success-rate probably podinfo.test is not receiving traffno values found","canary":"podinfo.test"} Advance podinfo.test canary weight 30 Advance podinfo.test canary weight 40 Halt podinfo.test advancement success rate 54.23% < 99% Halt podinfo.test advancement success rate 49.88% < 99% Halt podinfo.test advancement success rate 47.11% < 99% Rolling back podinfo.test failed checks threshold reached 5 Canary failed! Scaling down podinfo.test
Delete canary configuration:
kubectl -n test delete -f ./canary-demo.yaml
Delete Fortio:
helm -n test delete fortio
Delete test application:
kubectl -n test delete -k https://github.com/fluxcd/flagger//kustomize/podinfo?ref=main
Delete application namespace:
kubectl delete ns test
Delete kind cluster:
kind delete cluster --name flagger-demo