Prerequisites:
- GKE and CloudDNS
- Helm and Tiller
- Istio
Setup Istio with Let's Encrypt wildcard certs on Google Cloud by following this guide.
Flagger is a Kubernetes operator that automates the promotion of canary deployments using Istio routing for traffic shifting and Prometheus metrics for canary analysis.
Deploy Flagger and Grafana in the istio-system
namespace using Helm:
helm repo add flagger https://flagger.app
helm upgrade -i flagger flagger/flagger \
--namespace=istio-system \
--set metricsServer=http://prometheus.istio-system:9090 \
--set controlLoopInterval=1m
helm upgrade -i flagger-grafana flagger/grafana \
--namespace=istio-system
Prerequisites:
- Create a new branch from master
- Edit the
workloads/canary.yaml
and change thepodinfo.example.com
with your own domain - Push the changes to your branch
Before installing Flux scale down the weave agent anf flux deployments that are running in weave
namespace:
kubectl -n weave scale --replicas=0 deployment/weave-agent
kubectl -n weave scale --replicas=0 deployment/weave-flux-agent
Add the weaveworks repo:
helm repo add weaveworks https://weaveworks.github.io/flux
Install Flux using Helm (make sure to use a unique Flux git tag):
export GIT_BRANCH=your-branch
export GIT_TAG=your-git-tag
export WC_TOKEN=your-weave-token
helm upgrade -i flux weaveworks/flux \
--namespace flux \
--set helmOperator.create=true \
--set rbac.create=true \
--set registry.pollInterval=30s \
--set registry.cacheExpiry=24h \
--set git.pollInterval=2m \
--set git.url=ssh://git@github.com/weaveworks-experiments/istio-demo \
--set git.branch=${GIT_BRANCH} \
--set git.label=${GIT_TAG} \
--set token=${WC_TOKEN}
At startup Flux generates a SSH key and logs the public key. Find the SSH public key with:
kubectl -n flux logs deployment/flux | grep identity.pub | cut -d '"' -f2
In order to sync your cluster state with GitHub you need to copy the public key and create a deploy key with write access on your GitHub repository. Go to Settings > Deploy keys click on Add deploy key, check Allow write access, paste the Flux public key and click Add key.
Canary demo:
- Open the podinfo URL and it should display the
1.3.0
version - In Weave Cloud Deploy do a manual release of
quay.io/stefanprodan/podinfo:1.3.1
- The podinfo UI will automatically refresh and display the
1.3.1
version
Automated demo:
- In Weave Cloud Deploy enable automation for
test:deployment/podinfo
- Create a Flux filter of type semver
~1.3