Deploying service invocation to Azure Kubernetes Service
Table of contents
In this assignment, you will deploy the service communication to Azure Kubernetes Service (AKS). You will use the service invocation building block provided by Dapr.
Pre-requisites
- The first part Invoke Vehicle Registration Service from Fine Collection Service using Dapr is a pre-requisite for this assignment.
- Assignment 5 - Deploying to Azure Kubernetes Service is also a pre-requisite for this assignment.
Step 1: Deploy service invocation to AKS
-
Open
deploy/vehicleregistrationservice.yaml
in your code editor and uncomment the following lines:# annotations: # dapr.io/enabled: "true" # dapr.io/app-id: "vehicleregistrationservice" # dapr.io/app-port: "6002"
to give Vehicle Registration Service an
id
and aport
known to Dapr. -
Delete the image from local docker and from the Azure Container Registry:
docker rmi fine-collection-service:1.0-SNAPSHOT az acr repository delete -n $CONTAINER_REGISTRY --image fine-collection-service:latest
Where
$CONTAINER_REGISTRY
is the name of your Azure Container Registry. -
In the root folder of
FineCollectionService
, run the following command to build and push the image:mvn spring-boot:build-image docker tag fine-collection-service:1.0-SNAPSHOT $CONTAINER_REGISTRY.azurecr.io/fine-collection-service:latest docker push $CONTAINER_REGISTRY.azurecr.io/fine-collection-service:latest
Where
$CONTAINER_REGISTRY
is the name of your Azure Container Registry. -
From the root folder of the repo, run the following command:
kubectl apply -k deploy
Step 2. Test the applications running in AKS
-
Run the following command to identify the name of each microservice pod:
kubectl get pods
-
l\Look at the log file of each application pod to see the same output as seen when running on your laptop. For example:
kubectl logs finecollectionservice-ccf8c9cf5-vr8hr -c fine-collection-service
-
Delete all application deployments:
kubectl delete -k deploy
Cleanup
When the workshop is done, please follow the cleanup instructions to delete the resources created in this workshop.