Deploy App1 to Azure Kubernetes Service (AKS) Cluster - Exam AZ-104: Microsoft Azure Administrator

Deploy App1 to Cluster1

Question

You create the following resources in an Azure subscription:

-> An Azure Container Registry instance named Registry1

-> An Azure Kubernetes Service (AKS) cluster named Cluster1

You create a container image named App1 on your administrative workstation.

You need to deploy App1 to Cluster1.

What should you do first?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

C

You should sign in and push a container image to Container Registry.

Run the az acr build command to build and push the container image. az acr build \

--image contoso-website \

--registry $ACR_NAME \

--file Dockerfile .

https://docs.microsoft.com/en-us/learn/modules/aks-deploy-container-app/5-exercise-deploy-app

The correct answer is C. Run the az acr build command.

Explanation: Before deploying the container image to AKS cluster, the container image needs to be stored in a registry. In this scenario, the container image is stored in the Azure Container Registry (ACR) instance named Registry1. To deploy the container image to Cluster1, we need to follow these steps:

  1. Build the container image using Dockerfile. The Dockerfile is used to define the contents of the container image, including the application code, libraries, and dependencies.
  2. Tag the container image with the ACR instance login server name and the repository name. For example, if the ACR instance login server name is registry1.azurecr.io and the repository name is app1, the command will be: docker tag app1 registry1.azurecr.io/app1
  3. Log in to the ACR instance using the Azure CLI command az acr login.
  4. Push the container image to the ACR instance using the Docker push command: docker push registry1.azurecr.io/app1
  5. Create a Kubernetes deployment manifest file that defines the deployment of the container image to the AKS cluster.
  6. Use the kubectl apply command to deploy the container image to the AKS cluster: kubectl apply -f deployment-manifest.yaml

However, the scenario already provides that the container image named App1 is created on the administrative workstation. So, we can directly use the Azure CLI command az acr build to build the container image and push it to the ACR instance. This command will also create the Kubernetes deployment manifest file automatically.

Therefore, the correct answer is C. Run the az acr build command.