- Implementation of .NET Core Internet API
- Dockerization of utility
- Deploy utility picture on Azure Container Registry
- Run utility picture inside Azure Kubernetes Service (AKS)
- Visual Studio 2022
- Docker Desktop
- .NET Core 7 SDK and Runtime
- Azure Portal Subscription
Within the software program world, all of us need to automate issues and scale back guide work associated to the deployment and administration of various utility parts, in that case, azure supplies many providers for that like azure container registry and container occasion as I’ve proven under diagram.
- Azure container registry shops personal docker photographs and manages the identical.
- Azure container occasion is a managed service that helps us to run a container straight on the azure cloud with out requiring every other infrastructure like a digital machine (VM) and like that.
- Additionally, it helps to automate our utility deployment through the use of CI/CD instruments during which we configure some automation steps which construct and deploy our utility docker picture contained in the container registry and after that, we are able to simply run that picture contained in the azure container occasion in an remoted surroundings very effectively.
- Azure Kubernetes Service (AKS) is an open-source and totally managed container orchestration service out there on the Azure public cloud and used to deploy and handle completely different container photographs.
- AKS has provisioning to auto-scale sources with none downtime as per the requirement.
Implementation of .NET Core Internet API
Create a brand new .NET Core 7 Internet API
Configure your utility
Present further data
Add docker assist inside the applying utilizing Visual Studio
Run the applying utilizing the docker (Be aware: Make certain Docker Desktop is put in and operating in your machine)
Deploy utility picture on Azure Container Registry
Login on Azure Portal
Create Useful resource Group
After that, Create a brand new Azure Container Registry
Subsequent, right-click on the applying resolution and click on on publish
Click on on Docker Container Registry and press Subsequent
Choose Azure Container Registry and Click on Subsequent
After that, choose the subscription and container registry which we created earlier and click on on end.
Subsequent, click on on Publish and it’ll add a docker picture on the azure container registry.
Right here you’ll be able to see utility picture particulars contained in the repository part of our container registry on the Azure portal.
Run utility picture inside Azure Container Occasion
Crete the AKS Service on Azure
Subsequent, configure container registry which we created earlier
Open AKS and there we are able to discover particulars about AKS
Click on on join button and the credentials will get populated
Right here you’ll be able to see two instructions, that you could execute in your native CMD however for that, you want Azure CLI as a result of with out that AZ command won’t work. So, obtain Azure CLI from the next URL
Open CMD and enter the az login command it is going to open a window contained in the browser and you could present Azure credentials
Additionally, enter the 2 aks instructions after login as I confirmed within the above picture.
Create a pod.yml file and apply
apiVersion: v1 type: Pod metadata: identify: weather-forecast-app labels: app: weatherforecast-aks part: weatherforecast-app spec: containers: - picture: jdleaningregistry.azurecr.io/weatherforecastapplication:newest identify: weatherforecast-webapi ports: - containerPort: 80
Subsequent, create a service.yml file and apply
apiVersion: v1 type: Service metadata: labels: app: weatherforecast-aks identify: weatherforecast-aks spec: ports: - port: 8080 protocol: TCP targetPort: 80 selector: app: weatherforecast-aks part: weatherforecast-app kind: LoadBalancer
You possibly can see the standing and particulars about pods and providers utilizing a number of instructions as I confirmed under
In order for you extra particulars associated to pods and providers then execute describe instructions associated to Kubernetes
kubectl describe pod <podname> kubectl describe svc <service identify>
Open the AKS on Azure and click on on Companies and ingresses inside that we are able to see climate forecast particulars like exterior IP addresses and ports.
Lastly, hit the general public IP URL to fetch knowledge
Right here we focus on the Containerization of purposes utilizing Azure container registry and occasion. Additionally, the step-by-step like the best way to create the useful resource and run it on Azure.