Deploying applications to AKS and AKS in general seems daunting at first, but my initial exploration into Kubernetes is slowly unraveling the mystery. I now find the process of setting up AKS and deploying applications very straight-forward after working the process a few times.
I setup my AKS Cluster in my previous post Azure Kubernetes Service - Part 2 - Creating an AKS Cluster. This blog post is all about establishing the process for deploying a simple web application to AKS. The purpose of this post is to understand the process and steps for deploying applications to AKS and not about automating the process. I will save the automation for a later post.
1. Create a simple web application - I utilized one of the many examples out there and built a simple .NET Core API using .NET MVC and C#. This is a small API intended to represent an API used in a "Todo List" application. This sample is available for download on my GitHub if you like to see more... I did enable Swagger in order to simplify the testing of the application. The repository also contains a dockerfile used for containerization.
2. Build and Test Docker Image - I used a bash terminal in VS Code to execute the docker commands and this allows me to test the docker image. The dockerfile is part of the source code.
- docker build ./
- docker run ./
- docker tag ,/aksdemotodoapp <your-acr-name>.azurecr.io/aksdemotodoapp:v1
- docker push <your-acr-name>.azurecr.io/aksdemotodoapp:v1
4. Deploy the application to AKS - Use the "kubectl" command to execute the deployment script
- kubectl apply -f deployment.yaml
That is all there is ... You can no test our container in AKS by hitting the endpoint and viewing the swagger screen.
Please check out my previous posts around my personal study to learn AKS....