Skip to content

Commit d5ea1cf

Browse files
Updates for content guidelines.
1 parent 96b480f commit d5ea1cf

File tree

1 file changed

+84
-53
lines changed

1 file changed

+84
-53
lines changed

articles/aks/learn/quick-kubernetes-deploy-terraform.md

Lines changed: 84 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -479,48 +479,52 @@ When the application runs, a Kubernetes service exposes the application front en
479479
* [Install and configure Terraform](/azure/developer/terraform/quickstart-configure).
480480
* You can review the application code used in the Azure-Samples/[aks-store-demo repo][aks-store-demo].
481481

482-
## Clone the Azure Developer template
482+
## Clone the Azure Developer CLI template
483483

484-
1. Clone the AKS store demo template from the **Azure-Samples repository** using the `azd init` command with the `--template` parameter.
484+
1. Clone the AKS store demo template from the **Azure-Samples** repository using the [`azd init`][azd-init] command with the `--template` parameter.
485485

486-
```azurecli-interactive
487-
azd init --template aks-store-demo
486+
```azdeveloper
487+
azd init --template Azure-Samples/aks-store-demo
488488
```
489489

490-
1. Enter an environment name for your project. The environment name should use only alphanumeric characters and hyphens, such as the following example environment name:
490+
2. Enter an environment name for your project that uses only alphanumeric characters and hyphens, such as *aks-terraform-1*.
491491

492492
```output
493-
Enter a new environment name: aks-terraform-azd
493+
Enter a new environment name: aks-terraform-1
494494
```
495495

496-
## Login to your Azure account
496+
## Sign in to your Azure Cloud account
497497

498-
1. Sign in to your account using the `azd auth login` command.
498+
The `azd` template contains all the code needed to create the services, but you need to sign in to your Azure account in order to host the application on AKS.
499499

500-
```azurecli-interactive
500+
1. Sign in to your account using the [`azd auth login`][az-auth-login] command.
501+
502+
```azdeveloper
501503
azd auth login
502504
```
503505

504-
1. Copy the device code that appears and press `enter` to sign in.
506+
2. Copy the device code that appears in the output and press enter to sign in.
505507

506508
```output
507509
Start by copying the next code: XXXXXXXXX
508510
Then press enter and continue to log in from your browser...
509511
```
510512

511-
1. Authenticate with your credentials on your organization's sign in page.
513+
> [!IMPORTANT]
514+
> If you're using an out-of-network virtual machine or GitHub Codespace, certain Azure security policies cause conflicts when used to sign in with `azd auth login`. If you run into an issue here, you can follow the azd auth workaround provided below, which involves using a `curl` request to the localhost URL you were redirected to after running [`azd auth login`][az-auth-login].
512515

513-
1. Open your original terminal window and verify you received a successful sign in message similar to the following message:
516+
3. Authenticate with your credentials on your organization's sign in page.
517+
4. Confirm that it's you trying to connect from the Azure CLI.
518+
5. Verify the message "Device code authentication completed. Logged in to Azure." appears in your original terminal.
514519

515520
```output
516521
Waiting for you to complete authentication in the browser...
517522
Device code authentication completed.
518523
Logged in to Azure.
519524
```
520-
521525
[!INCLUDE [azd-login-ts](../includes/azd/azd-login-ts.md)]
522526

523-
## Deploy the application
527+
## Create and deploy resources for your cluster
524528

525529
To deploy the application, you use the `azd up` command to create all the objects required to run the [AKS Store application][aks-store-demo].
526530

@@ -536,71 +540,75 @@ To deploy the application, you use the `azd up` command to create all the object
536540
> [!NOTE]
537541
> We don't recommend running stateful containers, such as Rabbit MQ, without persistent storage for production. These are used here for simplicity, but we recommend using managed services, such as Azure CosmosDB or Azure Service Bus.
538542

539-
### Generate Terraform plans
540-
541-
Within your Azure Developer template, the `/infra/terraform` folder contains all the code used to generate the Terraform plan.
542-
543-
Terraform deploys and runs commands using `terraform apply` as part of `azd`.
544-
545-
A successful Terraform deployment plan results in a similar following message:
543+
### Deploy application resources
546544

547-
```output
548-
Plan: 5 to add, 0 to change, 0 to destroy.
549-
...
550-
Saved the plan to: /workspaces/aks-store-demo/.azure/aks-terraform-azd/infra/terraform/main.tfplan
551-
```
545+
`azd` runs all the hooks inside of the [`azd-hooks` folder](https://github.com/Azure-Samples/aks-store-demo/tree/main/azd-hooks) to preregister, provision, and deploy the application services.
552546

553-
### Deploy application resources
547+
The `azd` template for this quickstart creates a new resource group with an AKS cluster and an Azure key vault. The key vault stores client secrets and runs the services in the `pets` namespace
554548

555-
1. Create the application resources using the `azd up` command.
549+
1. Create all the application resources using the [`azd up`][azd-up] command.
556550

557551
```azdeveloper
558552
azd up
559553
```
560554

561-
1. Select an Azure subscription to bill your usage.
555+
2. Select an Azure subscription for your billing usage.
562556

563557
```output
564558
? Select an Azure Subscription to use: [Use arrows to move, type to filter]
565559
> 1. My Azure Subscription (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
566560
```
567561

568-
1. Select a region to deploy your application to.
562+
3. Select a region to deploy your application to.
569563

570564
```output
571565
Select an Azure location to use: [Use arrows to move, type to filter]
572-
40. (South America) Brazil Southeast (brazilsoutheast)
573-
41. (US) Central US (centralus)
574-
42. (US) East US (eastus)
566+
1. (South America) Brazil Southeast (brazilsoutheast)
567+
2. (US) Central US (centralus)
568+
3. (US) East US (eastus)
575569
> 43. (US) East US 2 (eastus2)
576-
44. (US) East US STG (eastusstg)
577-
45. (US) North Central US (northcentralus)
578-
46. (US) South Central US (southcentralus)
570+
4. (US) East US STG (eastusstg)
571+
5. (US) North Central US (northcentralus)
572+
6. (US) South Central US (southcentralus)
579573
```
580574

581-
1. Wait as azd automatically runs the commands for pre-provision and post-provision steps. Once completed, you should see an output with 3 `SUCCESS:` similar to the following example output:
575+
`azd` automatically runs the preprovisioning and postprovisioning commands to create the resources for your application. This process can take a few minutes to complete. Once complete, you should see an output similar to the following example:
582576

583577
```output
584-
SUCCESS: Your application was provisioned in Azure in 4 minutes 50 seconds.
578+
SUCCESS: Your workflow to provision and deploy to Azure completed in 9 minutes 40 seconds.
579+
```
585580

586-
SUCCESS: Your application was deployed to Azure in less than a second.
581+
### Generate Terraform plans
587582

588-
SUCCESS: Your up workflow to provision and deploy to Azure completed in 5 minutes 11 seconds.
589-
```
583+
Within your Azure Developer template, the `/infra/terraform` folder contains all the code used to generate the Terraform plan.
584+
585+
Terraform deploys and runs commands using `terraform apply` as part of `azd`'s provisioning step. Once complete, you should see an output similar to the following example:
586+
587+
```output
588+
Plan: 5 to add, 0 to change, 0 to destroy.
589+
...
590+
Saved the plan to: /workspaces/aks-store-demo/.azure/aks-terraform-azd/infra/terraform/main.tfplan
591+
```
590592

591593
## Test the application
592594

593595
When the application runs, a Kubernetes service exposes the application front end to the internet. This process can take a few minutes to complete.
594596

595-
1. Check the status of the deployed pods using the `kubectl get pods` command. Make all pods are `Running` before proceeding.
597+
1. Set your namespace as the demo namespace `pets` using the [`kubectl set-context`][kubectl-set-context] command.
598+
599+
```console
600+
kubectl config set-context --current --namespace=pets
601+
```
602+
603+
2. Check the status of the deployed pods using the [`kubectl get pods`][kubectl-get-pods] command. Make sure all pods are `Running` before proceeding.
596604

597605
```console
598606
kubectl get pods
599607
```
600608

601-
1. Check for a public IP address for the store-front application. Monitor progress using the `kubectl get service` command with the `--watch` argument.
609+
3. Check for a public IP address for the store-front application and monitor progress using the [`kubectl get service`][kubectl-get] command with the `--watch` argument.
602610

603-
```azurecli-interactive
611+
```console
604612
kubectl get service store-front --watch
605613
```
606614

@@ -611,27 +619,41 @@ When the application runs, a Kubernetes service exposes the application front en
611619
store-front LoadBalancer 10.0.100.10 <pending> 80:30025/TCP 4h4m
612620
```
613621

614-
1. Once the **EXTERNAL-IP** address changes from *pending* to an actual public IP address, use `CTRL-C` to stop the `kubectl` watch process.
622+
4. Once the **EXTERNAL-IP** address changes from *pending* to an actual public IP address, use `CTRL-C` to stop the `kubectl` watch process.
615623

616-
The following example output shows a valid public IP address assigned to the service:
624+
The following sample output shows a valid public IP address assigned to the service:
617625

618626
```output
619627
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
620628
store-front LoadBalancer 10.0.100.10 20.62.159.19 80:30025/TCP 4h5m
621629
```
622630

623-
1. Open a web browser to the external IP address of your service to see the Azure Store app in action.
631+
5. Open a web browser to the external IP address of your service to see the Azure Store app in action.
624632

625-
:::image type="content" source="media/quick-kubernetes-deploy-terraform/aks-store-application.png" alt-text="Screenshot of AKS Store sample application." lightbox="media/quick-kubernetes-deploy-terraform/aks-store-application.png":::
633+
:::image type="content" source="media/quick-kubernetes-deploy-cli/aks-store-application.png" alt-text="Screenshot of AKS Store sample application." lightbox="media/quick-kubernetes-deploy-cli/aks-store-application.png":::
626634

627-
### Delete application resources
635+
## Delete the cluster
628636

629-
1. Delete all the resources created in the quickstart using the `azd down` command. This uses the main.tfplan generated to clean up all created services.
637+
Once you're finished with the quickstart, clean up unnecessary resources to avoid Azure charges.
638+
639+
1. Delete all the resources created in the quickstart using the [`azd down`][azd-down] command.
630640

631641
```azdeveloper
632642
azd down
633643
```
634644

645+
2. Confirm your decision to remove all used resources from your subscription by typing `y` and pressing `Enter`.
646+
647+
```output
648+
? Total resources to delete: 14, are you sure you want to continue? (y/N)
649+
```
650+
651+
3. Allow purge to reuse the quickstart variables if applicable by typing `y` and pressing `Enter`.
652+
653+
```output
654+
[Warning]: These resources have soft delete enabled allowing them to be recovered for a period or time after deletion. During this period, their names may not be reused. In the future, you can use the argument --purge to skip this confirmation.
655+
```
656+
635657
:::zone-end
636658

637659
## Troubleshoot Terraform on Azure
@@ -647,14 +669,23 @@ To learn more about AKS and walk through a complete code-to-deployment example,
647669
> [!div class="nextstepaction"]
648670
> [Learn more about using AKS.][aks-home]
649671

672+
<!-- LINKS - External -->
673+
[aks-store-demo]: https://github.com/Azure-Samples/aks-store-demo
674+
[kubectl-get]: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get
675+
[kubectl-set-context]: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#config-set-context
676+
[kubectl-get-pods]: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get-pods
677+
650678
<!-- LINKS - internal -->
651679
[kubernetes-concepts]: ../concepts-clusters-workloads.md
652680
[kubernetes-deployment]: ../concepts-clusters-workloads.md#deployments-and-yaml-manifests
653681
[intro-azure-linux]: ../../azure-linux/intro-azure-linux.md
654682
[aks-solution-guidance]: /azure/architecture/reference-architectures/containers/aks-start-here?toc=/azure/aks/toc.json&bc=/azure/aks/breadcrumb/toc.json
655683
[baseline-reference-architecture]: /azure/architecture/reference-architectures/containers/aks/baseline-aks?toc=/azure/aks/toc.json&bc=/azure/aks/breadcrumb/toc.json
656684
[azd]: /azure/developer/azure-developer-cli/install-azd
685+
[azd-up]: /azure/developer/azure-developer-cli/reference#azd-up
686+
[azd-init]: /azure/developer/azure-developer-cli/reference#azd-init
687+
[azd-up]: /azure/developer/azure-developer-cli/reference#azd-up
688+
[az-auth-login]: /azure/developer/azure-developer-cli/reference#azd-auth-login
689+
[azd-install]: /azure/developer/azure-developer-cli/install-azd
690+
[azd-down]: /azure/developer/azure-developer-cli/reference#azd-down
657691
[aks-home]: /azure/aks
658-
659-
<!-- LINKS - External -->
660-
[aks-store-demo]: https://github.com/Azure-Samples/aks-store-demo

0 commit comments

Comments
 (0)