How to Deploy ASP.NET Web Application in Azure Kubernetes Services | Complete Tutorial | AKS - BRS MEDIA TECHNOLOGIES

How to Deploy ASP.NET Web Application in Azure Kubernetes Services | Complete Tutorial | AKS

Learning Outcomes

  • Creation and understanding of Azure Resource Group.
  • Creation and understanding of Azure Virtual Machine.
  • Working Experience with Azure CLI.
  • Creation and understanding of Azure Service principle.
  • Working Experience with Docker CE.
  • Working Experience with Git Bash Terminal in Microsoft Windows 10.
  • Working Experience with Microsoft Visual Studio 2019.
  • Creation and understanding of Azure Container Registry.
  • Understanding of Azure Kubernetes Service.
  • Understanding of Kubernetes and Pods.
  • Understanding of YML .
  • History of Azure Kubernetes Service.
  • Access permissions of Resources in Different Resource Groups.
  • Use of Azure Container registry in Azure Kubernetes Service.
  • Working experience with kubectl commands.

Install Docker in Ubuntu Server 20.04 LTS:-

sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt update
sudo apt install docker-ce -y

Docker Operation Commands:-

sudo systemctl status docker
sudo docker --version
sudo docker build -t webappproject .
sudo docker image ls
sudo docker run -d -p 5000:5000 webappproject
sudo docker ps

Install the Azure CLI Code:

sudo apt-get update
sudo apt-get install ca-certificates curl apt-transport-https lsb-release gnupg
AZ_REPO=$(lsb_release -cs)
echo "deb [arch=amd64] https://packages.microsoft.com/repos/… $AZ_REPO main" |
sudo tee /etc/apt/sources.list.d/azure-cli.list
sudo apt-get update
sudo apt-get install azure-cli

Azure Service Principle Codes:

azclouds@Azure:~$ az ad sp create-for-rbac -n "MySPN" --skip-assignment
azclouds@Azure:~$ SPN=$(az ad sp create-for-rbac -n "MySPN" --skip-assignment -o json)
azclouds@Azure:~$ echo $SPN | jq
azclouds@Azure:~$ echo $SPN | jq -r '.appId'
azclouds@Azure:~$ SCOPE="/subscriptions/ea9b2392-d4f8-4f83-b8f6-352da59d72eb/resourceGroups/DockerLearning"
azclouds@Azure:~$ az login --service-principal --username $(echo $SPN | jq -r '.appId') \
--password $(echo $SPN | jq -r '.password') \
--tenant $(echo $SPN | jq -r '.tenant')
az login --service-principal --username APP_ID --password PASSWORD --tenant TENANT_ID
az login --service-principal --username 1afca80f-5ffd-4259-a03b-xxxxxxxxxxxx --password V8k8OrPuDmn1UA-xxxxxxxxxxxxxxxxxxx --tenant 04c0f991-ed6d-4343-9b0c-xxxxxxxxxxxx

Azure Container Registry Login, Docker Image Tag and Push Code

sudo az acr login --name learncomputertech
sudo docker tag webappproject learncomputertech.azurecr.io/webappproject
sudo docker push learncomputertech.azurecr.io/webappproject

Commands used to Create Azure Kubernetes Services (AKS) :

az group create --name kubegroup --location eastus
az aks create --resource-group kubegroup --name aksdemo --node-count 1 --enabled-addons monitoring --generate-ssh-keys
az aks get-credentials --resource-group kubegroup --name aksdemo
kubectl get pods
kubectl get nodes
$AKS_RESOURCE_GROUP=”kubegroup”
$AKS_RESOURCE_NAME=”aksdemo”
$ACR_RESOURCE_GROUP=”LearningDocker”
$ACR_NAME=”learncomputertech”
$CLIENT_ID=$(az aks show --resource-group $AKS_RESOURCE_GROUP --name $AKS_RESOURCE_NAME --query “identityProfile.kubeletidentity.clientid” --output tsv)
$ACR_ID=$(az acr show --name $ACR_NAME --resource-group $ACR_RESOURCE_GROUP --query “id” --output tsv)
az role assignment create --assignee $CLIENT_ID --role acrpull --scope $ACR_ID
kubectl apply -f app.yml
kubectl apply -f services.yml
kubectl get service my-service --watch

Some Other Commands are

  1. Kubectl get pods
  2. Kubectl get services my-services
  3. Kubectl api-versions
  4. Kubectl describe Deployment
  5. Caution If you want to preserve your deployment don’t run delete command.
    Kubectl delete services my-services
  6. Kubectl delete deployment app-deployment
  7. Kubectl get nodes

AKS #azurekubernetesservices #kubernetes #docker #visualstudio #azure #dotnet #git #gitbash #winscp



Key Terms:

  • AKS
  • ,
  • azure
  • ,
  • azure kubernetes services
  • ,
  • docker
  • ,
  • dotnet
  • ,
  • git
  • ,
  • gitbash
  • ,
  • Kubernetes
  • ,
  • visual studio
  • ,
  • winscp

Other Angel Softwares

WinSCP

WinSCP utility to transfer files

Contents1 WinSCP utility to transfer files to Unix and Linux from Windows1.1 Security1.2 Built-in Text Editor1.3 Key Features:1.4 Summary1.5 Downloads1.6 […]

PuTTY

PuTTY utility to connect Unix and Linux

Contents1 PuTTY is a utility to connect Unix and Linux from Windows1.0.1 Downloads1.1 PuTTYgen1.1.1 How to use PuTTYgen?1.1.2 Types of […]

7zip

7zip Popular file compression utility

Contents1 7-Zip is a popular open-source file compression utility1.0.1 Key Features:1.0.2 Download1.0.3 Key Terms: 7-Zip is a popular open-source file […]

TrueNAS Scale Logo

Open Storage at Scale-TrueNAS Scale

TrueNAS SCALE is the latest member of the TrueNAS family and provides Open Source HyperConverged Infrastructure (HCI) including Linux containers and […]

Terraform Logo

HashiCorp Terraform-Automate Infrastructure on Any Cloud

Contents1 Build, change, and destroy infrastructure with Terraform.1.0.1 How does Terraform work?1.0.2 The core Terraform workflow consists of three stages:1.0.3 […]

Vagrant Logo

HashiCorp Vagrant – Development Environments Made Easy

Contents1 Introduction to Vagrant1.0.1 Why Vagrant?1.0.2 Powerful features1.0.3 Vagrant vs. Terraform1.0.4 Downloads1.0.5 Key Terms: Introduction to Vagrant Vagrant is a […]