You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Certain Azure security policies cause conflicts when used to sign in with `azd auth login`. As a workaround, you can perform a curl request to the localhost url you were redirected to after you logged in.
9
+
10
+
The workaround requires the Azure CLI for authentication. If you don't have it or aren't using GitHub Codespaces, install the [Azure CLI][install-azure-cli].
11
+
12
+
1. Inside a terminal, login with Azure CLI
13
+
```azurecli-interactive
14
+
az login --scope https://graph.microsoft.com/.default
15
+
```
16
+
1. Copy the "localhost" URL from the failed redirect
17
+
1. In a new terminal window, type `curl` and paste your url
18
+
1. If it works, code for a webpage saying "You have logged into Microsoft Azure!" appears
<p>You can close this window, or we will redirect you to the <a href="https://docs.microsoft.com/cli/azure/">Azure CLI documentation</a> in 1 minute.</p>
44
+
<h3>Announcements</h3>
45
+
<p>[Windows only] Azure CLI is collecting feedback on using the <a href="https://learn.microsoft.com/windows/uwp/security/web-account-manager">Web Account Manager</a> (WAM) broker for the login experience.</p>
46
+
<p>You may opt-in to use WAM by running the following commands:</p>
47
+
<code>
48
+
az config set core.allow_broker=true<br>
49
+
az account clear<br>
50
+
az login
51
+
</code>
52
+
</body>
53
+
</html>
54
+
```
55
+
56
+
5. Close the new terminal and open the old terminal
57
+
6. Copy and note down which subscription_id you want to use
58
+
7. Paste in the subscription_ID to the command `az account set -n {sub}`
Copy file name to clipboardExpand all lines: articles/aks/learn/quick-kubernetes-deploy-azd.md
+14-22Lines changed: 14 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,24 +76,12 @@ The Azure Development Template contains all the code needed to create the servic
76
76
Run `azd auth login`
77
77
78
78
1. Copy the device code that appears.
79
-
2. Hit enter to open in a new tab the auth portal.
80
-
3. Enter in your Microsoft Credentials in the new page.
81
-
4. Confirm that it's you trying to connect to Azure CLI. If you encounter any issues, skip to the Troubleshooting section.
82
-
5. Verify the message "Device code authentication completed. Logged in to Azure." appears in your original terminal.
79
+
1. Hit enter to open in a new tab the auth portal.
80
+
1. Enter in your Microsoft Credentials in the new page.
81
+
1. Confirm that it's you trying to connect to Azure CLI. If you encounter any issues, skip to the Troubleshooting section.
82
+
1. Verify the message "Device code authentication completed. Logged in to Azure." appears in your original terminal.
83
83
84
-
### Troubleshooting: Can't Connect to Localhost
85
-
86
-
Certain Azure security policies cause conflicts when trying to sign in. As a workaround, you can perform a curl request to the localhost url you were redirected to after you logged in.
87
-
88
-
The workaround requires the Azure CLI for authentication. If you don't have it or aren't using GitHub Codespaces, install the [Azure CLI][install-azure-cli].
89
-
90
-
1. Inside a terminal, run `az login --scope https://graph.microsoft.com/.default`
91
-
2. Copy the "localhost" URL from the failed redirect
92
-
3. In a new terminal window, type `curl` and paste your url
93
-
4. If it works, code for a webpage saying "You have logged into Microsoft Azure!" appears
94
-
5. Close the terminal and go back to the old terminal
95
-
6. Copy and note down which subscription_id you want to use
96
-
7. Paste in the subscription_ID to the command `az account set -n {sub}`
- If you have multiple Azure subscriptions, select the appropriate subscription for billing using the [az account set](/cli/azure/account#az-account-set) command.
99
87
@@ -102,9 +90,9 @@ The workaround requires the Azure CLI for authentication. If you don't have it o
102
90
The step can take longer depending on your internet speed.
103
91
104
92
1. Create all your resources with the `azd up` command.
105
-
2. Select which Azure subscription and region for your AKS Cluster.
106
-
3. Wait as azd automatically runs the commands for pre-provision and post-provision steps.
107
-
4. At the end, your output shows the newly created deployments and services.
93
+
1. Select which Azure subscription and region for your AKS Cluster.
94
+
1. Wait as azd automatically runs the commands for pre-provision and post-provision steps.
95
+
1. At the end, your output shows the newly created deployments and services.
108
96
109
97
```output
110
98
deployment.apps/rabbitmq created
@@ -121,6 +109,12 @@ The step can take longer depending on your internet speed.
121
109
122
110
When your application is created, a Kubernetes service exposes the application's front end service to the internet. This process can take a few minutes to complete. Once completed, follow these steps verify and test the application by opening up the store-front page.
123
111
112
+
1. Set your namespace as the demo namespace `pets` with the `kubectl set-context` command.
1. View the status of the deployed pods with the [kubectl get pods][kubectl-get] command.
125
119
126
120
Check that all pods are in the `Running` state before proceeding:
@@ -161,8 +155,6 @@ When your application is created, a Kubernetes service exposes the application's
161
155
162
156
Once on the store page, you can add new items to your cart and check them out. To verify, visit the Azure Service in your portal to view the records of the transactions for your store app.
163
157
164
-
<!-- Image of Storefront Checkout -->
165
-
166
158
## Delete the cluster
167
159
168
160
Once you're finished with the quickstart, remember to clean up all your resources to avoid Azure charges.
Copy file name to clipboardExpand all lines: articles/aks/tutorial-kubernetes-deploy-application.md
+82-10Lines changed: 82 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Kubernetes on Azure tutorial - Deploy an application to Azure Kubernetes Service (AKS)
3
3
description: In this Azure Kubernetes Service (AKS) tutorial, you deploy a multi-container application to your cluster using images stored in Azure Container Registry.
4
4
ms.topic: tutorial
5
-
ms.date: 11/02/2023
5
+
ms.date: 02/20/2023
6
6
ms.custom: mvc
7
7
#Customer intent: As a developer, I want to learn how to deploy apps to an Azure Kubernetes Service (AKS) cluster so that I can deploy and run my own applications.
8
8
---
@@ -29,15 +29,19 @@ In this tutorial, part four of seven, you deploy a sample application into a Kub
29
29
30
30
## Before you begin
31
31
32
-
In previous tutorials, you packaged an application into a container image, uploaded the image to Azure Container Registry, and created a Kubernetes cluster. To complete this tutorial, you need the pre-created`aks-store-quickstart.yaml` Kubernetes manifest file. This file download was included with the application source code in a previous tutorial. Make sure you cloned the repo and changed directories into the cloned repo. If you haven't completed these steps and want to follow along, start with [Tutorial 1 - Prepare application for AKS][aks-tutorial-prepare-app].
32
+
In previous tutorials, you packaged an application into a container image, uploaded the image to Azure Container Registry, and created a Kubernetes cluster. To complete this tutorial, you need the precreated`aks-store-quickstart.yaml` Kubernetes manifest file. This file was downloaded in the application source code from [Tutorial 1 - Prepare application for AKS][aks-tutorial-prepare-app].
33
33
34
34
### [Azure CLI](#tab/azure-cli)
35
35
36
-
This tutorial requires Azure CLI version 2.34.1 or later. Run `az --version` to find the version. If you need to install or upgrade, see [Install Azure CLI][azure-cli-install].
36
+
This tutorial requires Azure CLI version 2.0.53 or later. Check your version with `az --version`. To install or upgrade, see [Install Azure CLI][azure-cli-install].
37
37
38
38
### [Azure PowerShell](#tab/azure-powershell)
39
39
40
-
This tutorial requires Azure PowerShell version 5.9.0 or later. Run `Get-InstalledModule -Name Az` to find the version. If you need to install or upgrade, see [Install Azure PowerShell][azure-powershell-install].
40
+
This tutorial requires Azure PowerShell version 5.9.0 or later. Check your version with `Get-InstalledModule -Name Az`. To install or upgrade, see [Install Azure PowerShell][azure-powershell-install].
41
+
42
+
### [Azure Developer CLI](#tab/azure-azd)
43
+
44
+
This tutorial requires Azure Developer CLI (AZD) version 1.5.1 or later. Check your version with `azd version`. To install or upgrade, see [Install Azure Developer CLI][azure-azd-install].
41
45
42
46
---
43
47
@@ -53,7 +57,7 @@ In these tutorials, your Azure Container Registry (ACR) instance stores the cont
53
57
az acr list --resource-group myResourceGroup --query "[].{acrLoginServer:loginServer}" --output table
54
58
```
55
59
56
-
2. Make sure you're in the cloned *aks-store-demo* directory, and then open the manifest file with a text editor, such as `vi`:
60
+
2. Make sure you're in the cloned *aks-store-demo* directory, and then open the manifest file with a text editor, such as `vi`.
57
61
58
62
```azurecli-interactive
59
63
vi aks-store-quickstart.yaml
@@ -85,7 +89,7 @@ In these tutorials, your Azure Container Registry (ACR) instance stores the cont
2. Make sure you're in the cloned *aks-store-demo* directory, and then open the manifest file with a text editor, such as `vi`:
92
+
2. Make sure you're in the cloned *aks-store-demo* directory, and then open the manifest file with a text editor, such as `vi`.
89
93
90
94
```azurepowershell-interactive
91
95
vi aks-store-quickstart.yaml
@@ -109,11 +113,45 @@ In these tutorials, your Azure Container Registry (ACR) instance stores the cont
109
113
110
114
4. Save and close the file. In `vi`, use `:wq`.
111
115
116
+
117
+
### [Azure Developer CLI](#tab/azure-azd)
118
+
119
+
AZD doesn't require a container registry step since it's in the template.
120
+
112
121
---
113
122
114
-
## Deploy the application
123
+
## Run the application
124
+
125
+
### [Azure CLI](#tab/azure-cli)
126
+
127
+
1. Deploy the application using the [`kubectl apply`][kubectl-apply] command, which parses the manifest file and creates the defined Kubernetes objects.
128
+
129
+
```console
130
+
kubectl apply -f aks-store-quickstart.yaml
131
+
```
132
+
133
+
The following example output shows the resources successfully created in the AKS cluster:
134
+
135
+
```output
136
+
deployment.apps/rabbitmq created
137
+
service/rabbitmq created
138
+
deployment.apps/order-service created
139
+
service/order-service created
140
+
deployment.apps/product-service created
141
+
service/product-service created
142
+
deployment.apps/store-front created
143
+
service/store-front created
144
+
```
145
+
146
+
2. Check the deployment is successful by viewing the pods with `kubectl`
147
+
148
+
```console
149
+
kubectl get pods
150
+
```
151
+
152
+
### [Azure PowerShell](#tab/azure-powershell)
115
153
116
-
* Deploy the application using the [`kubectl apply`][kubectl-apply] command, which parses the manifest file and creates the defined Kubernetes objects.
154
+
1. Deploy the application using the [`kubectl apply`][kubectl-apply] command, which parses the manifest file and creates the defined Kubernetes objects.
117
155
118
156
```console
119
157
kubectl apply -f aks-store-quickstart.yaml
@@ -132,17 +170,35 @@ In these tutorials, your Azure Container Registry (ACR) instance stores the cont
132
170
service/store-front created
133
171
```
134
172
173
+
2. Check the deployment is successful by viewing the pods with `kubectl`
174
+
175
+
```console
176
+
kubectl get pods
177
+
```
178
+
179
+
### [Azure Developer CLI](#tab/azure-azd)
180
+
181
+
Deployment in AZD in broken down into multiple stages represented by hooks. Run `azd up` as an all-in-one command.
182
+
183
+
When you first run azd up, you're prompted to select which Subscription and Region to host your Azure resources.
184
+
185
+
You can update these variables for `AZURE_LOCATION` and `AZURE_SUBSCRIPTION_ID` from inside the `.azure/<your-env-name>/.env` file.
186
+
187
+
---
188
+
135
189
## Test the application
136
190
137
191
When the application runs, a Kubernetes service exposes the application front end to the internet. This process can take a few minutes to complete.
138
192
193
+
### Command Line
194
+
139
195
1. Monitor progress using the [`kubectl get service`][kubectl-get] command with the `--watch` argument.
140
196
141
197
```console
142
198
kubectl get service store-front --watch
143
199
```
144
200
145
-
Initially, the `EXTERNAL-IP` for the *store-front* service shows as *pending*.
201
+
Initially, the `EXTERNAL-IP` for the *store-front* service shows as *pending*:
@@ -158,14 +214,28 @@ When the application runs, a Kubernetes service exposes the application front en
158
214
159
215
3. View the application in action by opening a web browser to the external IP address of your service.
160
216
217
+
:::image type="content" source="./learn/media/quick-kubernetes-deploy-cli/aks-store-application.png" alt-text="Screenshot of AKS Store sample application." lightbox="./learn/media/quick-kubernetes-deploy-cli/aks-store-application.png":::
218
+
161
219
If the application doesn't load, it might be an authorization problem with your image registry. To view the status of your containers, use the `kubectl get pods` command. If you can't pull the container images, see [Authenticate with Azure Container Registry from Azure Kubernetes Service](cluster-container-registry-integration.md).
162
220
221
+
### Azure portal
222
+
223
+
Navigate to your Azure portal to find your deployment information.
224
+
225
+
1. Open your [Resource Group][azure-rg] on the Azure portal
226
+
1. Navigate to the Kubernetes service for your cluster
227
+
1. Select `Services and Ingress` under `Kubernetes Resources`
228
+
1. Copy the External IP shown in the column for store-front
229
+
1. Paste the IP into your browser and visit your store page
230
+
231
+
:::image type="content" source="./learn/media/quick-kubernetes-deploy-cli/aks-store-application.png" alt-text="Screenshot of AKS Store sample application." lightbox="./learn/media/quick-kubernetes-deploy-cli/aks-store-application.png":::
232
+
163
233
## Next steps
164
234
165
235
In this tutorial, you deployed a sample Azure application to a Kubernetes cluster in AKS. You learned how to:
166
236
167
237
> [!div class="checklist"]
168
-
>
238
+
>
169
239
> * Update a Kubernetes manifest file.
170
240
> * Run an application in Kubernetes.
171
241
> * Test the application.
@@ -176,12 +246,14 @@ In the next tutorial, you learn how to use PaaS services for stateful workloads
176
246
> [Use PaaS services for stateful workloads in AKS][aks-tutorial-paas]
0 commit comments