Skip to content

Commit 887cec7

Browse files
Edits to migrate-to-azure-container-apps-blue-green.md.
1 parent cce066f commit 887cec7

File tree

1 file changed

+52
-45
lines changed

1 file changed

+52
-45
lines changed
Lines changed: 52 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
---
2-
title: The Experience of Blue-Green Deployment in Azure Container Apps
3-
description: Describes the experience of blue-green deployment in Azure Container Apps.
2+
title: Blue-Green Deployment to Azure Container Apps
3+
description: Describes blue-green deployment to Azure Container Apps.
44
author: KarlErickson
55
ms.author: karler
6+
ms.reviewer: dingmeng-xue
67
ms.service: azure-spring-apps
78
ms.topic: upgrade-and-migration-article
8-
ms.date: 03/10/2025
9+
ms.date: 03/13/2025
910
ms.custom: devx-track-java, devx-track-extended-java
1011
---
1112

12-
# The Experience of Blue-Green Deployment in Azure Container Apps
13+
# Blue-green deployment to Azure Container Apps
1314

1415
**This article applies to:** ✅ Basic/Standard ✅ Enterprise
1516

@@ -21,11 +22,11 @@ To create a new container app with multiple active revisions enabled, use the fo
2122

2223
```azurecli
2324
az containerapp create \
24-
--resource-group <RESOURCE_GROUP> \
25-
--name <APP_NAME> \
26-
--environment <APP_ENVIRONMENT_NAME> \
27-
--image mcr.microsoft.com/k8se/samples/test-app:<BLUE_COMMIT_ID> \
28-
--revision-suffix <BLUE_SUFFIX> \
25+
--resource-group <resource-group> \
26+
--name <app-name> \
27+
--environment <app-environment-name> \
28+
--image mcr.microsoft.com/k8se/samples/test-app:<blue-commit-ID> \
29+
--revision-suffix <blue-suffix> \
2930
--ingress external \
3031
--target-port 80 \
3132
--revisions-mode multiple
@@ -35,8 +36,8 @@ Alternatively, you can use the following command to update an existing app to en
3536

3637
```azurecli
3738
az containerapp revision set-mode \
38-
--resource-group <RESOURCE_GROUP> \
39-
--name <APP_NAME> \
39+
--resource-group <resource-group> \
40+
--name <app-name> \
4041
--mode multiple
4142
```
4243

@@ -46,97 +47,103 @@ To deploy a new revision, use the following command:
4647

4748
```azurecli
4849
az containerapp update \
49-
--resource-group <RESOURCE_GROUP> \
50-
--name <APP_NAME> \
50+
--resource-group <resource-group> \
51+
--name <app-name> \
5152
--image mcr.microsoft.com/k8se/samples/test-app:<GREEN_COMMIT_ID> \
5253
--revision-suffix <GREEN_SUFFIX>
5354
```
5455

55-
To add labels to a specific revision, use the following command:
56+
To add labels to a specific revision, use the following commands:
5657

5758
```azurecli
5859
az containerapp revision label add \
59-
--name <APP_NAME> \
60-
--resource-group <RESOURCE_GROUP> \
61-
--label blue \
62-
--revision <BLUE_REVISION_NAME>
60+
--resource-group <resource-group> \
61+
--name <app-name> \
62+
--label blue \
63+
--revision <blue-revision-name>
6364
6465
az containerapp revision label add \
65-
--name <APP_NAME> \
66-
--resource-group <RESOURCE_GROUP> \
67-
--label green \
68-
--revision <GREEN_REVISION_NAME>
66+
--resource-group <resource-group> \
67+
--name <app-name> \
68+
--label green \
69+
--revision <green-revision-name>
6970
```
70-
Here, `<BLUE_REVISION_NAME>` is `<APP_NAME>--<BLUE_SUFFIX>`, and `<GREEN_REVISION_NAME>` is `<APP_NAME>--<GREEN_SUFFIX>`. A label can only be assigned to one revision at a time.
7171

72-
Initially, the revision with the *blue* `commitId` takes 100% of production traffic, while the newly deployed revision with the *green* `commitId` doesn't take any production traffic.
72+
Here, `<blue-revision-name>` is `<app-name>--<blue-suffix>`, and `<green-revision-name>` is `<app-name>--<green-suffix>`. A label can only be assigned to one revision at a time.
73+
74+
Initially, the revision with the blue `commitId` takes 100% of production traffic, while the newly deployed revision with the green `commitId` doesn't take any production traffic.
7375

7476
In Azure Spring Apps, you can deploy at most two revisions of one app: one set as Production and the other as Staging. However, Azure Container Apps supports deploying multiple revisions for a single app.
7577

76-
## Test new revision
78+
## Test a new revision
7779

78-
Each revision in Azure Container Apps has its own URL, enabling you to test and verify your deployment against the specific URL. Test the green revision with a specific domain, even though all production traffic is directed to the blue revision:
80+
Each revision in Azure Container Apps has its own URL, enabling you to test and verify your deployment against the specific URL. Use the following commands to test the green revision with a specific domain, even though all production traffic is directed to the blue revision:
7981

8082
```azurecli
81-
GREEN_DOMAIN=$(az containerapp revision show --resource-group <RESOURCE_GROUP> --name <APP_NAME> --revision <GREEN_REVISION_NAME> --query "properties.fqdn" -o tsv)
83+
export GREEN_DOMAIN=$(az containerapp revision show \
84+
--resource-group <resource-group> \
85+
--name <app-name> \
86+
--revision <green-revision-name> \
87+
--query "properties.fqdn"
88+
--output tsv)
8289
8390
curl -s https://$GREEN_DOMAIN
8491
```
8592

86-
Additionally, test with the label-specific FQDN:
93+
Use the following commands to test with the label-specific fully qualified domain name (FQDN):
8794

8895
```azurecli
8996
# Get the containerapp environment default domain
90-
export APP_ENV_DOMAIN=$(az containerapp env show \
91-
--resource-group <RESOURCE_GROUP> \
92-
--name <APP_ENVIRONMENT_NAME> \
97+
export APP_DOMAIN=$(az containerapp env show \
98+
--resource-group <resource-group> \
99+
--name <app-environment-name> \
93100
--query "properties.defaultDomain" \
94101
--output tsv)
95102
96103
# Test the production FQDN
97-
curl -s https://$APP_NAME.$APP_ENV_DOMAIN
104+
curl -s https://$APP_NAME.$APP_DOMAIN
98105
99106
# Test the blue label FQDN
100-
curl -s https://$APP_NAME---blue.$APP_ENV_DOMAIN
107+
curl -s https://$APP_NAME---blue.$APP_DOMAIN
101108
102109
# Test the green label FQDN
103-
curl -s https://$APP_NAME---green.$APP_ENV_DOMAIN
110+
curl -s https://$APP_NAME---green.$APP_DOMAIN
104111
```
105112

106113
## Send production traffic to the green revision
107114

108-
To switch production traffic to the green revision, use the following command:
115+
To switch production traffic to the green revision, use the following commands:
109116

110117
```azurecli
111118
# switch based on revision name
112119
az containerapp ingress traffic set \
113-
--resource-group <RESOURCE_GROUP> \
114-
--name <APP_NAME> \
115-
--revision-weight <BLUE_REVISION_NAME>=0 <GREEN_REVISION_NAME>=100
120+
--resource-group <resource-group> \
121+
--name <app-name> \
122+
--revision-weight <blue-revision-name>=0 <green-revision-name>=100
116123
117124
# switch based on label
118125
az containerapp ingress traffic set \
119-
--resource-group <RESOURCE_GROUP> \
120-
--name <APP_NAME> \
126+
--resource-group <resource-group> \
127+
--name <app-name> \
121128
--label-weight blue=0 green=100
122129
```
123130

124131
Ensure that the total label weight equals 100%.
125132

126-
Azure Container Apps not only allows you to switch traffic between blue-green deployments but also between multiple revisions. Additionally, you can redirect a specific amount of production traffic to the green deployment.
133+
Azure Container Apps not only enables you to switch traffic between blue-green deployments but also between multiple revisions. You can also redirect a specific amount of production traffic to the green deployment.
127134

128135
For more information about blue-green deployment in Azure Container Apps, see [Blue-Green Deployment in Azure Container Apps](../../container-apps/blue-green-deployment.md).
129136

130137
## Limitation
131138

132139
The Eureka Server isn't suitable for blue-green deployment because all revisions of the app are registered with the Eureka Server, preventing effective traffic splitting.
133140

134-
To enable traffic splitting when using Spring Cloud Gateway, you need to set the application URL in the URI field of your gateway configuration. You can obtain the application URL using the following command:
141+
To enable traffic splitting when using Spring Cloud Gateway, you need to set the application URL in the URI field of your gateway configuration. You can obtain the application URL by using the following command:
135142

136143
```azurecli
137144
az containerapp show \
138-
--resource-group <RESOURCE_GROUP> \
139-
--name <APP_NAME> \
145+
--resource-group <resource-group> \
146+
--name <app-name> \
140147
--query "properties.configuration.ingress.fqdn" \
141148
--output tsv
142-
```
149+
```

0 commit comments

Comments
 (0)