Preparation, Docker Image Push and Deployment for Containerized Voting Application in Kubernetes Cluster using Docker, Azure Container Registry (ACR) and Azure Kubernetes Service (AKS)
In another project based on a real world scenario, I had to act as a DevOps Engineer, and show a new team member how to deploy an application on a Kubernetes cluster.
This cluster is part of The Cloud Bootcamp project, and I prepared this new team member to deploy the voting application that was developed for the MultiCloud Experience, an online event where participants had the opportunity to learn about Cloud technologies.
I deployed it to Microsoft Azure cloud, where I first pushed the application’s Docker image to Azure Container Registry and then used the Azure Kubernetes Service (AKS) service to deploy a cluster managed by Microsoft Azure.
Create a Azure Container Registry (ACR):
az group create --name tcb-vote --location eastus
az acr create --resource-group tcb-vote --name tcbwilliampeixoto --sku Basic
Don’t forget to copy the loginServer to Notepad; this information will be used to log in to ACR.
Push the application’s Docker image to Azure Container Registry:
sudo docker tag thecloudbootcamp/tcb-vote:latest tcbwilliampeixoto.azurecr.io/tcb-vote:latest
sudo az acr login --name tcbwilliampeixoto.azurecr.io
sudo docker push tcbwilliampeixoto.azurecr.io/tcb-vote:latest
For those who don’t like the command line, it’s also possible to create the ACR and Kubernetes cluster via the Azure console:
Just checking if everything was created correctly:
Setting up the Kubernetes Cluster
az aks create \
--resource-group tcb-vote \
--name AKSClusterTCB \
--node-count 1 \
--generate-ssh-keys \
--attach-acr tcbwilliampeixoto
Just checking if everything was created correctly:
After setting up the Kubernetes Cluster, I deployed the voting application into it.
kubectl apply -f tcb-vote-plus-redis.yaml
Subsequently, by utilizing the public IP address of the load balancer within the Kubernetes Cluster, I successfully accessed the voting application from my browser.
Employing Docker, Azure Container Registry, and Kubernetes Services allowed me to seamlessly deploy an application from a container in a fully automated manner. =)