This topic tells you how to use blue-green deployment with Packages and PackageInstalls using Flagger for Supply Chain Choreographer (beta).
Blue-green deployment is an application delivery model that lets you gradually transfer user traffic from one version of your app to a later version while both are running in production.
This currently works with only workloads of type server
.
To use blue-green deployment, you must complete the following prerequisites:
To get the name of the deployment you want to use, identify the name of the deployment and service that are part of the PackageInstall by running:
kubectl get deployment --namespace=prod
This displays a list of all the deployments and services in the current Kubernetes namespace, with their current names. For example:
NAME READY UP-TO-DATE AVAILABLE AGE
hello-app-deployment 1/1 1 1 103
Create a canary custom resource using the Flagger instructions using the deployment name from the earlier step.
Flagger creates three ClusterIP services: hello-app.dev.tap-primary
, hello-app.dev.tap-canary
, hello-app.dev.tap
. It also creates a shadow deployment named app-primary
that represents the blue version.
When a new version is detected, Flagger scales up the green version and runs the conformance tests, the tests target the hello-app.dev.tap-canary
ClusterIP service to reach the green version. If the conformance tests are passing, Flagger starts the load tests and validate them with custom Prometheus queries.
If the load test analysis is successful, Flagger promotes the new version to hello-app.dev.tap-primary
and scales down the green version. Flagger extends a canary analysis through custom metrics and webhooks for running load tests, acceptance tests, or any other custom validation.