Site icon Rajeev Singh | Coder, Blogger, YouTuber

Rehost an on-premises application to Containers

To take advantage of the benefits of the cloud and new technologies like containers, you should at least partially modernize your existing .NET applications. Ultimately, modernizing your enterprise applications will lower your total cost of ownership.

Overview:

You can initially modernize your existing applications with important but easy to do modernization. You can maintain your current code base, written in existing .NET Framework versions, with any Windows and IIS dependencies.  The below picture highlights how Cloud-Optimized apps are positioned in Azure application modernization maturity models.

Diagram of how to position cloud-optimized applications.    

  

Business drivers

With a Cloud-Optimized application, you can rapidly and repeatedly deliver reliable applications to your customers. You gain essential agility and reliability by deferring much of the operational complexity of your app to the platform.

The Cloud-Native modernization maturity level usually requires new development investments. Moving to the Cloud-Native level typically is driven by the business need to modernize applications.

Migration goals

Solution design

With Azure, you have the flexibility to choose from a variety of hosting options for your applications spanning the spectrum of infrastructure-as-a-service (IaaS), platform-as-a-service (PaaS), containers-as-a-service (CaaS), and serverless.

Azure offerings such as Azure App Service and Azure Kubernetes Service (AKS) are helping application developers focus on solving the most important business problems.

Tools & technologies

The Azure Migrate App Containerization tool helps you containerize your applications and migrate them to Azure. In this preview, the tool can help you containerize ASP.NET applications running on Windows servers and Java web applications running on Apache Tomcat on Linux servers. The tool lets you package the application into a container image and helps you deploy the application container to Azure Kubernetes Service.

The Azure Migrate App Containerization tool currently supports:

The App Containerization tool helps you:

The Container Ecosystem in Azure

Before we start designing the proposed architecture, let’s understand the Container ecosystem in Azure.

Microsoft Azure provides an open and broad variety of choices, a full container ecosystem in the cloud (shown in the diagram below). Depending on your specific application’s needs, you should choose one or another Azure product.

These ecosystems are broadly categorized into IaaS and PaaS solutions.

Containerization Use Case (when to use what)?

We explored to select the right Azure Compute in Re-Host scenario: App modernization- re-host scenario – Rajeev Singh | Coder, Blogger, YouTuber (wpcomstaging.com)

Now, let’s deep dive and check the use case for container options.

Containerization Decision Tree for Legacy Windows App

Before we decide to use it, let’s check the decision tree below, whether the application is supported for containerization or not.

Ideal candidates for containerizing

Type of applicationWhy these are good candidates
Special considerations
Console applicationsWith no GUI limitations, console apps are ideal candidates for containers.Use the appropriate base container image depending on the application’s needs.
Windows servicesBecause these are background processes not requiring any direct user interactionUse the appropriate base container image depending on the application’s needs. You need to create a foreground process to keep any containerized background process running. See the section on Background services below.
Windows Communication Foundation (WCF) servicesBecause they’re service-oriented apps that can also run in the backgroundUse the appropriate base container image depending on the application’s needs. You may need to create a foreground process to keep any containerized background process running. See the section on Background services below.
Web appsWeb applications are in essence background services listening on a specific port and are therefore great candidates for containerization, as they can leverage the scalability offered by containersUse the appropriate base container image depending on the application’s needs.

What can’t be moved to Windows containers?

Applications/features not supported.Why not supportedCan you work around this?
Applications requiring a desktopContainers don’t support Graphic User Interface (GUI)If the application only requires a GUI to install, changing it to a silent install might be a solution
Applications using Remote Desktop Protocol (RDP)RDP is for interactive sessions, so the principle above applies here as wellYou may be able to use Windows Admin Center (WAC) or Remote PowerShell as an alternative for remote management
Stateful applicationsContainers are ephemeralYes, some applications might require minimal change, so they don’t store data or state inside the container
Database applicationsContainers are ephemeralYes, some applications might require minimal change, so they don’t store data or state inside the container
Active DirectoryThe design and purpose of Active Directory precludes running in a containerNo. However, apps that are Active Directory dependent can use Group Managed Service Accounts (gMSA).
Older Windows Server versionsOnly Windows Server 2016 or later is supportedNo. However, application compatibility might be an option – most Windows Server 2008/R2 and older apps run on newer versions of Windows Server
Apps using .NET Framework version 2.0 or olderSpecific container images are required to support the .NET Framework, and only more recent versions are supportedVersions earlier than 2.0 aren’t supported at all, but see below for the container images required for later versions
Apps using other third-party frameworksMicrosoft doesn’t specifically certify or support the use of non-Microsoft frameworks on Windows ContainersCheck with the vendor of the specific framework or app the support policy for Windows containers. See below for more information

When to use which Container Options (On-Prem VM, IaaS VM, ACI, ACS -Kubernetes)

Let’s summarize and deep dive on this topic:

The first step is to classify whether the App can be containerized or not.

The second step is to determine and use the options as mentioned below.

Use CaseOptions
Need full-fledged Orchestration?Azure Container Instance
Need full-fledged Orchestration and familiar with Service Fabric or older .Net Framework?Azure Service Fabric
Using Red Hat OpenShiftAzure Red Hat OpenShift (ARO)
Need access to Kubernetes API?Azure Kubernetes Service (AKS)
Don’t need access to Kubernetes API?Azure Container Apps
Don’t need Managed service and own Orchestration implementation on Azure VMsVMware Tanzu on Azure VM Kubernetes on Azure VM OpenShift on Azure VM

Let’s deep dive into these scenarios:

On-premises IaaS VM infrastructure

Azure VMs (IaaS cloud)

The main scenarios for using Windows Containers in an Azure VM are:

Azure Container Instances (ACI)

The main value proposition of Azure Container Instances is that you can right away deploy containers to it and you don’t need to maintain that environment, you don’t need to upgrade/patch the underlying operating system or VMs, all that is transparent and you just deploy containers into a ready-to-use environment.

The reasons and scenarios when you would want to use ACI are similar to the main scenarios when you use Azure VMs with containers.

The main scenarios for using Azure Container Instances are:

The main benefits of Azure Container Instances (ACI) are:

In short, with ACI you can develop apps fast without managing virtual machines or having to learn new tools. It’s just your application, in a container, running in the cloud.

Azure Container Service (Kubernetes)

Azure Container Service optimizes the configuration of popular open-source tools and technologies specifically for Azure. You get an open solution that offers portability both for your containers and for your application configuration. You select the size, the number of hosts, and the orchestrator tools. Azure Container Service handles the infrastructure for you.

If you are already working with open-source orchestrators like Kubernetes, Docker Swarm, or DC/OS, you don’t need to change your existing management practices to move container workloads to the cloud.

Use the application management tools that you’re already familiar with and connect via the standard API endpoints for the orchestrator of your choice.

For example, in Kubernetes, support for containers is native (first-class citizen), so using Windows Containers on Kubernetes is also effective (in preview in ACS as of early 2018).

Azure compute

As a by-default recommendation, the following is the main criteria recommended in this guidance:

Current architecture

Now, it’s time to understand what’s the current architecture of the app.

Proposed architecture

Based on analyzing the current architecture, the team understands the requirements and comes up with the below-proposed solution.

Application qualities for containerization

Since App doesn’t need full-fledged control over the containerized app, the App can be containerized and migrated to Azure App Service.

Migration methods

The app can be containerized and migrated to Azure App Service using Azure Migrate App Containerization Tool.

The containerization process doesn’t require access to your codebase and provides an easy way to containerize existing applications.

The tool works by using the running state of the applications on a server to determine the application components.

It then helps you package them in a container image. You can then deploy the containerized application on Azure App Service.

Migration process

Below are the steps for this migration process:

Prerequisites:

Identify a machine on which to install the tool.

Application servers

Start Migration:

Refer to this link for complete steps ASP.NET app containerization and migration to App Service – Azure Migrate | Microsoft Learn

Validate the deployment.

Once deployment is successful, validate the deployment and check app running is successful in App service.

Conclusion

In this article, we covered details of Containerization scenarios, when to use which container services. We explored asp.net application use case to understand the current architecture and proposed Containerization solution. Discussed about the steps for migration.

We covered scenarios to containerized applications to Azure App Service using Azure Migrate, in the next post we will talk about different aspects, such as Security, Monitoring, and day-2 operations guide (triage, ongoing maintenance of deployed assets, etc.)

References:

Modernize existing .NET apps to Cloud-Optimized applications – .NET | Microsoft Learn

Deploy existing .NET apps as Windows containers – .NET | Microsoft Learn

Lift and shift to containers | Microsoft Learn

ACA vs AKS: Azure Services for Containerized Apps (microsoft.com)

Exit mobile version