Friday, September 29, 2023
HomeC#Deploying a .NET Core Software in Azure Kubernetes

Deploying a .NET Core Software in Azure Kubernetes

In growth, sustaining the discharge and deployment workflow is without doubt one of the most crucial areas of a undertaking. Due to this fact, many groups wish to create an automatic deployment workflow to handle their releases and manufacturing. Sustaining an automatic deployment workflow might be complicated, however it can save the staff effort and time.

Azure DevOps is without doubt one of the finest platforms to create an automatic CI/CD pipeline for an utility, making this job simple. This text will focus on the steps to deploy a .NET Core utility in Azure Kubernetes utilizing the Azure DevOps Starter.


What Are Containers and Container Orchestration?

To grasp the performance of Kubernetes, you should first perceive the ideas of containers and container orchestration.

Containers are a type of the virtualized working system. A container comprises all important executables, binary code, dependencies, and configuration information. A single container can execute something from a microservice or software program course of to a significantly massive utility.

Containers appear to be very scalable since they are often produced as wanted. However the complexity will increase when you should preserve a whole bunch or hundreds of containers, and it turns into unimaginable to handle all their lifecycles. That is the state of affairs wherein container orchestration involves the rescue.

Containers’ upkeep, deployment, scaling, and networking might be automated utilizing a container orchestration system. As well as, you possibly can deploy the identical utility throughout a number of environments utilizing container orchestration quite than having to redevelop or redesign it.

What Is Kubernetes?

Kubernetes, also referred to as K8s, is a well known open-source container administration (orchestration) expertise for automating functions’ deployment, scaling, and administration.

The Kubernetes orchestration options enable the event of utility companies that span throughout many containers, the scheduling of containers in a cluster, the deployment of these containers, and management of the standing of the containers over time.

Discover the very best and most complete Blazor UI elements library available in the market.

Discover Now

What Is Azure Kubernetes Service?

Developed on prime of the open-source Kubernetes expertise, Azure Kubernetes Service (AKS) is a managed container orchestration service. You need to use AKS to manage your hosted Kubernetes surroundings and simply launch, scale, and handle containerized apps.

By means of on-demand useful resource provisioning, updating, and scaling, AKS simplifies Kubernetes deployment and operation. It allows you to execute your functions within the cloud whereas eliminating the complexity and operational burden of Kubernetes administration.

As well as, your growth and operations groups can collaborate on a single platform utilizing AKS to construct and deploy functions extra effectively.

How one can Deploy a .NET Core Software in Azure Kubernetes

Step 1: Create an Azure DevOps starter undertaking.

Sign up to your Azure portal, click on the Create a useful resource possibility, and choose DevOps Starter. Then, you’ll be navigated to the place you possibly can create the DevOps Starter undertaking. It’s a must to full 4 fundamental steps to create the undertaking.

a. Select the runtime.

Choose the .NET runtime, as proven within the following determine, to run the ASP.NET Core utility

Choose the .NET option

b. Select the framework.

Choose ASP.NET Core because the framework for the runtime, as proven within the following determine.

Choose ASP.NET Core as the framework

c. Select the service.

Then, choose Kubernetes because the Azure service to deploy this utility.

Choose Kubernetes as the Azure Service

d. Create the undertaking with the mandatory configurations.

Now, configure the Azure subscription and settings for the Kubernetes cluster. I’ll clarify these configurations within the upcoming step.

Every thing a developer must know to make use of Blazor elements within the Blazor app is totally documented.

Learn Now

Step 2: Configure the subscription and Azure Kubernetes service.

We have to do just a few configurations within the fourth a part of creating the DevOps Starter undertaking. We’ll use GitHub to create a repository for this undertaking. As proven within the following determine, it’s essential authorize entry to Azure to your GitHub private account.

Authorize access to Azure for your GitHub personal account

There are another configurations to be completed after authorizing the GitHub account. First, choose the group. Right here, selects your GitHub account as a private account. There’s a area named Repository within the subsequent determine: use it so as to add the identify of the repository to be created within the GitHub account. This repository will probably be used to deploy the Azure Kubernetes service. Then, choose the subscription for the DevOps Starter undertaking. I will probably be utilizing the Azure for College students subscription for this demonstration.

Select the repository and subscription for the DevOps Starter project

Then, create a brand new cluster or use one you have got already created.

If you will create a brand new cluster for this undertaking, first add a reputation for the cluster. Then, choose the placement wherein to create this service. After, choose Standard_B2ms, primarily based on the B-series burstable VMs, because the digital machine measurement. Use this VM to create the service for testing and demonstration functions.

Add further settings if you happen to want them in accordance with your necessities or subscription plan. For instance, in case you are utilizing a scholar subscription, you possibly can alter the settings as proven within the following picture.

Additional Settings dialog

The coed subscription has some limitations. It’s a must to set the node rely to 1 and select the Fundamental service tier for the Container Registry SKU, as it’s a cost-optimized tier appropriate for studying and testing functions.

Lastly, click on Assessment+Create to create the Azure DevOps Starter undertaking, which is able to deploy the ASP.NET Core utility within the Azure Kubernetes service. It is going to take a couple of minutes to create the undertaking.

After a couple of minutes, verify your GitHub repository to verify a brand new repository was created with the identify you offered. You possibly can see the workflow that has been mechanically created for the GitHub motion. It will likely be used to automate the CI/CD pipeline. It’s also possible to customise it if wanted.

Workflow added for the newly created GitHub repositoryThe Azure assets and the standing of the GitHub workflow can even be seen within the Azure portal after deploying it to the Kubernetes service, as proven within the following picture.Azure portal displaying the Azure resources and the status of the GitHub workflow

Discover the totally different utility UIs developed utilizing Syncfusion Blazor elements.

Strive Now

Moreover, you possibly can entry the ASP.NET Core utility utilizing the exterior endpoint. There, you will notice the applying as proven within the following determine.

Accessing ASP.NET Core app using external endpoint

Step 3: Verify the CI/CD pipeline.

Now, verify the CI/CD pipeline you created utilizing the Azure DevOps Starter by cloning the ASP.NET Core undertaking to your native machine with the assistance of the next git command.

git clone {git-repo-link}.git

For the benefit of viewing and modifying information, let’s use Visible Studio Code 2022 to open the cloned utility. Then, open the file named index.html contained in the Pages folder.

Then, you possibly can edit it as you want. To reveal how the modifications will activate the CI/CD pipeline, let’s change the <div class= “content-body”> div component as proven within the following code snippet.

<div class="content-body">
   <div class="success-text">Success!</div>
   <div class="description line-1">GitHub workflow has been efficiently setup</div>
   <div class="description line-2">Deploying DotNet Core Software In Azure Kubernetes</div>

Then, run and verify it regionally. After that, push the newest modifications with a commit. First, add the modifications to the staging space.

git add .

Second, commit the modifications with an applicable commit message into the native repository.

git commit -m "Replace index.html"

Third, push the commits to the GitHub repository.

git push -u origin fundamental

The GitHub motion will set off the construct pipeline after efficiently pushing the commits.

GitHub action triggering the build pipeline after pushing the commitsAfter finishing the construct course of, it can deploy the applying to the Azure Kubernetes service.

Deploying the ASP.NET Core app to the Azure Kubernetes serviceYou possibly can verify your Azure Kubernetes service after deploying the applying to it by clicking the exterior endpoint, as proven within the following determine.

Click on the external endpoint to access the deployed app

See how Syncfusion Blazor elements might be reworked into stunning and environment friendly functions.

Strive Now

Right here, you see that the newest model of the applying was deployed efficiently to the Azure Kubernetes service.

Deploying ASP.NET Core app in Azure Kubernetes


This text mentioned the way to deploy an ASP.NET Core app to the Azure Kubernetes service utilizing the Azure DevOps Starter, with the assistance of GitHub actions, to create an automatic CI/CD pipeline for the app. This course of eliminates the complexity of the deployment course of considerably.

I hope this text will enable you to in your subsequent undertaking.

The Syncfusion ASP.NET Core UI management library, powered by Important JS 2, is the one suite you’ll ever have to construct an app. It comprises over 70 high-performance, light-weight, modular, and responsive UI controls in a single bundle. Use them to construct gorgeous internet apps!

In the event you’re already a Syncfusion consumer, you possibly can obtain the product setup . If not, you possibly can obtain a free 30-day trial to guage our merchandise.

You possibly can contact us by way of our help discussion boardhelp portal, or suggestions portal. As all the time, we’re pleased to help you!

Thanks for studying!

Associated blogs



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments