Skip to main content

Version: 3.5.x

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

  1. Select Published Services of your gateway group from the side navigation bar, then click the service you want to modify, for example, httpbin.
  2. Under the published service, select Upstreams from the side navigation bar.
  3. In the Default Upstream module, click Edit, rename the upstream to Blue Upstream, and click Save.
  4. Click Add Upstream.
  5. 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 and 80 as the port.
    • Click Add.
  6. Click ViewID at the upstream header(under the Actions button) and copy for use.

Configure Traffic-Split Plugin

  1. Under the published service, select Plugins from the side navigation bar.
  2. Click Add Plugin.
  3. Search for the traffic-split plugin, then click Add.
  4. 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


API7.ai Logo

API Management for Modern Architectures with Edge, API Gateway, Kubernetes, and Service Mesh.

Product

API7 Cloud

SOC2 Type IIISO 27001HIPAAGDPRRed Herring

Copyright © APISEVEN PTE. LTD 2019 – 2025. Apache, Apache APISIX, APISIX, and associated open source project names are trademarks of the

Apache Software Foundation