Get Started with Blue/Green Deployment
Blue/Green deployment overview
A blue/green strategy shifts traffic from the running version of your software to a new version of your software. The Armory CD-as-a-Service blue/green strategy follows these steps:
- Armory CD-as-a-Service deploys a new version of your software without exposing it to external traffic.
- Armory CD-as-a-Service executes one or more user-defined steps in parallel. These steps are pre-conditions for exposing the new version of your software to traffic. For example, you may want to run automated metric analysis or wait for manual approval.
- After all pre-conditions complete successfully, Armory CD-as-a-Service redirects all traffic to the new software version. At this stage of the deployment, the old version of your software is still running but is not receiving external traffic.
- Next, Armory CD-as-a-Service executes one or more user-defined steps in parallel. These steps are pre-conditions for tearing down the old version of your software. For example, you may want to pause for an hour or wait for an additional automated metric analysis.
- After all pre-conditions complete successfully, Armory CD-as-a-Service tears down the old version of your software.
Before you begin
This quick start assumes that you completed the prior two quick starts that taught you how to register a cluster with Armory CD-as-a-Service and how to deploy an app with the CLI.
To complete this quick start, you need the following:
- Access to a Kubernetes cluster where you can install the Remote Network Agent (RNA). This cluster acts as the deployment target for the sample app. You can reuse the cluster from the previous quick starts or create a new one.
- You need to deploy a Kubernetes Service object that sends traffic to the current version of your application. This is the
trafficManagement.kubernetes.activeServicefield in the YAML configuration.
- (Optional) You can also create a
previewServiceKubernetes Service object so you can programmatically or manually observe the new version of your software before exposing it to traffic via the
activeService. This is the
trafficManagement.kubernetes.previewServicefield in the YAML configuration.
Add blue/green to your deployment
In your deploy file, go to the
Create a new strategy named
blue-green-deploy-stratlike the following:
strategies: blue-green-deploy-strat blueGreen: redirectTrafficAfter: - pause: untilApproved: true shutDownOldVersionAfter: - pause: untilApproved: true
See the Deployment File Reference for an explanation of these fields.
This strategy is configured to pause for manual judgment before redirecting traffic to your new app version as well as before shutting down your old version. You could instead choose to pause for a duration of time.
Change the value of
targets.<targetName>.strategyfor one or more of your deployment targets to
... targets: <targetName>: account: <agentIdentifier> namespace: <namespace> strategy: blue-green-deploy-strat ...
At the bottom of your file, create a top-level traffic management configuration for your
... trafficManagement: - targets: ['<targetName>'] kubernetes: - activeService: myAppActiveService previewService: myAppPreviewService ...
The values for
previewServicemust match the names of the Kubernetes Service objects you created to route traffic to the current and preview versions of your application. See the Deployment File Reference for an explanation of these fields.
Save the file
Redeploy your app
Make a change to your app, such as the number of replicas, and redeploy it with the CLI:
armory deploy start -f <your-deploy-file>.yaml
Monitor the progress and Approve & Continue or Roll back the blue/green deployment in the UI.
Was this page helpful?
Thank you for letting us know!
Sorry to hear that. Please tell us how we can improve.
Last modified May 29, 2022: (975089c8)