Configure Blue-Green Deployment
Blue-green deployment is a strategy that minimizes downtime and risk by using two identical environments: Blue (current live) and Green (new version). Traffic is switched from Blue to Green once the new version is verified, allowing seamless updates. If issues occur, you can quickly revert to Blue, ensuring continuous service with minimal disruption.
Configure Blue/Green Upstreams
- Select Published Services of your gateway group from the side navigation bar, then click the service you want to modify, for example,
httpbin
. - Under the published service, select Upstreams from the side navigation bar.
- In the Default Upstream module, click Edit, rename the upstream to
Blue Upstream
, and click Save. - Click Add Upstream.
- In the dialog box, do the following:
- In the Upstream Name field, enter
Green Upstream
. - Click Add Node to adjust the host of the node to point to the new backend. For example, use
172.16.1.82
as the host and80
as the port. - Click Add.
- In the Upstream Name field, enter
- Click ViewID at the upstream header(under the Actions button) and copy for use.
Configure Traffic-Split Plugin
- Under the published service, select Plugins from the side navigation bar.
- Click Add Plugin.
- Search for the
traffic-split
plugin, then click Add. - In the dialog box, do the following:
Add the following configuration to the JSON Editor:
{
"rules": [
{
"weighted_upstreams": [
{
"upstream_id": green_upstream_id, // Use upstream id, not upstream name
"weight": 1
},
{
"weight": 0
}
]
}
]
}Click Add.
Validate
Validate the Green Upstream by sending a request:
curl "http://127.0.0.1:9080/headers" -v
You will receive a 200 OK
response with the header green
.
Additional Resources
- Key Concept
- Plugin Hub