Angular + .NET Core +SQL on Azure AKS by pulumi

Ha Doan
3 min readJun 16, 2020

In this blog post, I am going to setup a web server from scratch on Azure AKS by using Pulumi typescript application.

The technology stack is Angular and .NET Core rest api based on http://abp.io framwork, it shows basic information of top rated movies, the source is stored at https://github.com/hadoan/TmdbMovies

  • Create new AKS instance

Generate public key and set pulumi config

ssh-keygen -t rsa -f key.rsa
pulumi config set sshPublicKey < key.rsa.pub
pulumi config set aks_password strong_password

Then define new AKS cluster in typescript as below:

AKS cluster definition
  • Deploy SQL and AKS

Run Pulumi up to create SQL Server and AKS instances

This is the result

The full source-code for Azure deployment is at https://github.com/hadoan/TmdbMovies/tree/master/azure-pulumi

  • Create new k8s Pulumi project: pulumi new kubernetes-typescript

The source-code for k8s pulumi here https://github.com/hadoan/TmdbMovies/tree/master/k8s-pulumi, following are steps:

  • Create dockerfile for angular application
angular dockerfile
  • Deploy to DockerHub, you can also push image to Azure Container Registry by guidance here
docker build -t tmdbmovies-frontend
docker tag tmdbmovies-frontend hadoanmanh/tmdbmovies-frontend
docker push
  • Create docker file for .net core and deploy to DockerHub

After that we have 2 docker images in docker hub:

Backend: https://hub.docker.com/repository/docker/hadoanmanh/tmdbmovies-api

Frontend: https://hub.docker.com/repository/docker/hadoanmanh/tmdbmovies-frontend

  • Create Kubernetes deployment to deploy .NET core Backend
.net core backend deployment
  • Define .net core back-end service
back-end service
az aks get-credentials --resource-group resource-group-abp-microservice-demo --name demo-aksclustercc4d76ed
Result!
  • Run pulumi upto deploy backend and angular to AKS
  • Enable AKS dashboard
Enable AKS dashboard
az aks enable-addons -g resource-group-abp-microservice-demo -n demo-akscluster34a4f9c3 -a kube-dashboard

View dashboard

az aks browse — resource-group resource-group-abp-microservice-demo — name demo-akscluster34a4f9c3
AKS dashboard

Go to service to see IP of your angular and backend service, my demo application is hosted at http://52.187.150.193/

Have fun to play with AKS!

--

--