Overview
Blue/green deployment is a release strategy that reduces downtime and risk by running two identical production environments: one active (blue) and one idle (green). When a new version is ready, you deploy it to the idle environment, validate it, and then switch all traffic over instantly. If something goes wrong, you roll back by switching traffic back to the original environment. On Control Plane, blue/green deployments are implemented using two separate Workloads within the same GVC, combined with Domain path-based or subdomain-based routing to control which workload receives live traffic.How It Works
Control Plane’s Domain resource supports path-based and subdomain-based routing, allowing requests to be directed to any workload within a GVC. A blue/green deployment takes advantage of this by maintaining two workloads simultaneously and updating the Domain route to point to whichever is currently active.The Two Environments
Theblue workload runs the current production version of your application. The green workload runs the new version you want to deploy. Only one workload receives external traffic at any given time, but both remain running until the switch is confirmed.
| Blue Environment (Current) | Green Environment (New) |
|---|---|
| Serves all live production traffic | Receives no external traffic until cutover |
| Validated, stable release | New version under test and validation |
| Scaled to handle full production load | Can be pre-scaled before traffic switch |
| Active target in Domain routing rules | Inactive; endpoint accessible for testing |
| Deleted or kept on standby after cutover | Becomes the new blue after promotion |
Traffic Routing
Traffic is controlled by a Control PlaneDomain resource. By updating the workloadLink field in a domain route, you redirect all incoming traffic from the blue workload to the green workload. This switch takes effect globally across all locations in your GVC within seconds, without downtime.
Control Plane domains support two routing modes for blue/green deployments:
- Path-based routing (
dnsMode: cname) - Routes requests to different workloads based on URL path prefix. Recommended for most blue/green setups because you maintain full DNS control and it is CDN/WAF compatible. - Subdomain-based routing (
dnsMode: ns) - Assigns a unique subdomain to each workload automatically. Use this if your architecture requires distinct DNS names per workload.
The Deployment Lifecycle
- Deploy the green workload with the new image version.
- Validate the green workload using its internal Control Plane endpoint or a staging domain.
- Update the Domain routing rule to point to the green workload.
- Monitor the green workload in production.
- Decommission the blue workload, or keep it on standby for rapid rollback.
Because the switch is a single Domain configuration change, rollback is equally instant: update the route back to the blue workload link.
Prerequisites
- A Control Plane account with an active Org.
- The Control Plane CLI (
cpln) installed and authenticated. See the CLI Reference for setup instructions. - An existing GVC with at least one location configured.
- A
blueworkload already deployed and serving production traffic. - A Domain configured and associated with your GVC.
- The new application image built and pushed to your org’s private registry. See the Push an Image guide.
Replace all placeholder values in the examples below (
ORG_NAME, GVC_NAME, DOMAIN_NAME, and image tags) with values specific to your environment.The CLI commands and YAML manifests in this guide are generic examples intended to illustrate structure. For a real deployment, export the configuration of your existing blue workload and use that as the basis for the green workload definition. This ensures your green workload inherits all of your current container settings, environment variables, resource limits, probes, and firewall rules exactly.Export your current workload using the CLI:Then update the
name field to my-app-green and change the container image to the new version before applying. You can also export from the Console by navigating to your workload, clicking Actions, and selecting Export.Step-by-Step Guide
All steps in this guide can be completed using either the Control Plane CLI or the Console UI. CLI commands are shown throughout for reproducibility and automation. Where the Console UI approach differs meaningfully, instructions are included inline.Step 1: Deploy the Green Workload
Create a new workload running the new image version. Choose its name carefully before creating it — workload names cannot be changed after creation. A clear, consistent naming scheme (such asmy-app-blue and my-app-green, or my-app-v1 and my-app-v2) makes it easy to identify which workload is active at a glance.
The most reliable starting point is to export the configuration of your existing blue workload and modify it, rather than writing a manifest from scratch. This guarantees the green workload matches your current production settings exactly.
Export and prepare the green workload manifest:
name to my-app-green and update the container image to the new version tag, then apply it:
- CLI
- YAML (generic example)
- Console UI
Step 2: Validate the Green Workload
Before switching traffic, verify that the green workload is healthy and behaving as expected. Use the workload’s canonical endpoint, which is accessible without modifying any domain routing. Check the workload deployment status:Step 3: Switch Traffic to Green
Once validation passes, update your Domain resource to route production traffic tomy-app-green instead of my-app-blue. This is the cutover step.
As with the workload, you can export your current domain configuration as a starting point:
workloadLink in the relevant route to point to my-app-green and apply. The YAML shown in the tabs below is a generic example illustrating which field to change.
- Path-Based Routing (Recommended)
- Subdomain-Based Routing
- CLI Patch (Quick Cutover)
- Console UI
If your domain uses Apply the change:
dnsMode: cname, update the workloadLink in the relevant route:The domain update propagates to all locations in the GVC within seconds. There is no staged rollout of the routing change itself; it is atomic and global.
Step 4: Monitor the Green Workload
After the traffic switch, monitor the green workload to confirm it is handling production load correctly. Keep the blue workload running during this observation period to enable rapid rollback. View workload logs in real time:Step 5: Decommission or Keep the Blue Workload
Once you are confident the green workload is stable, you have two options for the blue workload:Option A: Delete the Blue Workload
Option A: Delete the Blue Workload
If you do not need a rapid rollback standby, delete the blue workload to free up resources:In the Console, navigate to the
my-app-blue workload, click Actions, and select Delete.Option B: Scale Down and Keep on Standby
Option B: Scale Down and Keep on Standby
Scale the blue workload to its minimum replica count (or to zero if using KEDA autoscaling) to reduce cost while keeping it available for rollback:In the Console, navigate to the
my-app-blue workload, click Scaling in the left menu, and set the Min Scale value to 0.my-app-blue), update the Domain route, and repeat the process.
Rolling Back
If you detect a problem with the green workload, rolling back is the reverse of the cutover: update the Domain route to point back to the blue workload.- Console UI
- cpln apply
- In the Console, navigate to your Org and click Domains in the left menu.
- Select your domain and click Edit.
- Under Ports, expand the relevant port and locate the route pointing to
my-app-green. - Update the Workload field back to
my-app-blue. - Click Update. Traffic returns to the blue workload within seconds.
Because the blue workload was never stopped, rollback is instant. Traffic returns to the previous version within seconds of the domain update propagating.
Automating with CI/CD
Blue/green deployments integrate naturally into CI/CD pipelines using the Control Plane CLI or Terraform. The pipeline automates the image build, green workload creation, health check, and traffic switch steps.GitHub Actions Example
The following workflow builds the new image, deploys it to a green workload, runs a health check, and performs the traffic cutover if the check passes.Advanced Patterns
Mirror Traffic for Pre-Production Validation
Control Plane domains support amirror routing property that sends a copy of live traffic to a secondary workload. This allows you to validate the green workload under real production load before committing to the cutover, without exposing users to any green responses.
Mirror traffic is fire-and-forget: the mirrored workload’s response is not returned to the client, so errors on the green workload are invisible to users.
Multi-Location Considerations
Control Plane workloads and domains are global by default. When you update a Domain route, the change propagates to every location in the GVC. There is no built-in mechanism to switch one location at a time. If you need location-specific traffic control, use separate GVCs for each region and route at the DNS layer, or use the GVC location routing options to adjust traffic distribution by latency or priority. Contact Control Plane support at support@controlplane.com for guidance on complex multi-region deployment patterns.Environment Naming Conventions
Theblue/green names are conventions. Some teams prefer my-app-stable and my-app-canary, or versioned names like my-app-v1 and my-app-v2. Because workload names cannot be changed after creation, choose your naming scheme before creating workloads and apply it consistently. Only one workload should be the target of the production Domain route at any time.
You may also use Control Plane tags to annotate which workload is currently active, making it easy to identify the production workload programmatically:
Quick Reference
| Action | Command |
|---|---|
| Create green workload | cpln workload create --name my-app-green --image //image/my-app:2.0 --gvc GVC |
| Check workload status | cpln workload get my-app-green --gvc GVC --org ORG |
| View workload logs | cpln logs --workload my-app-green --gvc GVC --org ORG --tail |
| Update workload image | cpln workload update my-app-green --set spec.containers.main.image=//image/my-app:2.1 --gvc GVC |
| Switch domain to green | cpln apply --file domain-green.yaml --org ORG |
| Roll back to blue | cpln apply --file domain-blue.yaml --org ORG |
| Scale blue to zero | cpln workload update my-app-blue --set spec.defaultOptions.autoscaling.minScale=0 --gvc GVC |
| Delete blue workload | cpln workload delete my-app-blue --gvc GVC --org ORG |
| Export workload as YAML | cpln workload get my-app-blue --gvc GVC -o yaml-slim > workload.yaml |
| Add deployment tag | cpln workload update my-app-green --set tags.deployment-role=active --gvc GVC |
Related Resources
Workload Reference
Full workload configuration options including autoscaling, probes, and container settings.
Domain Reference
Domain routing modes, path-based routing, mirror routing, and TLS configuration.
Apply YAML Manifests
Using cpln apply for declarative, repeatable resource management.
CI/CD Examples
Pipeline examples for GitHub Actions, GitLab CI, Bitbucket, and CircleCI.
Push an Image
Build and push container images to your org’s private Control Plane registry.
GVC (Global Virtual Cloud)
How GVCs define location placement, pull secrets, and DNS geo-routing.