AWS, Azure, Cloud Computing

5 Mins Read

Simplifying Container App Management with Path-Based Routing in Azure Application Gateway

Overview

Path-based routing is a technique used in networking and web application routing to direct incoming traffic to different destinations based on the path component of the Uniform Resource Locator (URL).
In path-based routing, the URL path is used as a routing criterion to direct the request to the appropriate destination. For example, a web server or a load balancer may use the path component of the URL to route requests to different backends or services.

Path-based routing can direct requests for the web interface to a different backend or service then requests for the API, thus allowing for more granular control over traffic routing.

It is commonly used in modern web applications, especially those built using a microservices architecture, to enable flexible and efficient routing of traffic to different services based on the application’s specific needs.

Introduction Container App

A container app is an application that is packaged and deployed using containerization technology. Containerization is a way to package an application along with its dependencies into a self-contained unit called a container. Containers can be easily moved from one environment to another, making them ideal for deploying applications to the cloud.

Pioneers in Cloud Consulting & Migration Services

  • Reduced infrastructural costs
  • Accelerated application deployment
Get Started

Step-by-Step Guide

  1. Create a container app
  • In the Azure portal, search for the container app
  • Click on Create Container app
  • Choose your resource group
  • Enter Container app name – mycontainerapp1
  • Choose a region
  • Click on Create New Container Apps Environment
  • Under the Basic and Monitoring tab, keep it default.
  • Under Networking tab
  • Select yes Use your virtual network
  • Select your Virtual network and infrastructure subnet and click on Create
  • Click on Next: Appsettings
  • Choose the image, and ingress should be enabled
  • Click on Review + Create
  • And click on create

Create One more Container app the same way on the same Virtual network and region

step1

Application Gateway

Azure Application Gateway is a web traffic load balancer and application delivery controller (ADC) that provides high scalability, security, and availability for web applications.

It is a fully managed service in Azure that provides several advanced features, such as SSL offloading, SSL termination, URL-based routing, path-based routing, session affinity, and web application firewall (WAF) capabilities.

Application Gateway enables you to route traffic to multiple backend servers based on various routing rules, such as cookie-based affinity, session persistence, and round-robin load balancing. It can also perform health checks on your backend servers and automatically remove unhealthy servers from the pool.

With Application Gateway, you can manage and optimize traffic to your web applications, improve application performance and availability, and protect your applications from common web application attacks.

2. Create and configure Application Gateway

  • Click on Create Application gateway
  • Choose your resource group
  • Enter Container app name – mycontainerapp1
  • Choose a region – Select the region where your Container Apps is provisioned.
  • Select Standard V2 for tier
  • Enable autoscaling – Leave as default
  • Availability zone – Choose None. Availability Zones are advised for higher availability in production environments.
  • HTTP2 – keep it default.
  • Choose the virtual network that your container app is associated with.
  • Click on Manage subnet configuration
    select +Subnet Enter the name of the subnet
  • Keep the default values for the remaining parameters.
  • To create the new subnet, choose Save.
  • Create a subnet for the application gateway.
  • Close the Subnets window. To return to the Create application gateway window

step2

step2b

  • Click on Next: Frontends to proceed.
  • On the Frontends tab
  • Select Public for Frontend IP address type
  • In Public IP address – Select Add new. Enter the name of your frontend and select OK

step2c

  • Click on Next: backends to proceed.
  • The backend pool is used to direct requests to the right backend servers.
  • The following resources can be combined to create backend pools:
  1. NICs
  2. Public IP addresses
  3. Internal IP addresses
  4. Virtual Machine Scale Sets
  5. Fully qualified domain names (FQDN)
  6. Multi-tenant back-ends like Azure App Service and Container Apps
  • Here we create a backend pool that targets the container app.
  • Create a backend pool that targets your container app.
  • Select Add a Backend pool
  • Select No to Add backend pool without targets
  • Target type – Select IP address or FQDN.
  • Target – copy the Application Url from the Overview window of the Container App and remove the https://
  • Select Add

step2d

  • Click on Next: Configuration tab
  • Select Add a routing rule
  • Enter the name
  • Enter priority 1
  • Under the Listener tab, Enter Listener name
  • In Frontend IP – Select Public
  • Protocol – Pick HTTPS. HTTP can be chosen if you don’t have a certificate
  • Select Basic for Listener Type
  • Error page URL – Leave as No

step2f

  • Toggle to the Backend Targets tab
  • Target type – Select the backend pool that is created earlier
  • Backend settings – Select Add new
  • Enter Backend settings name, Backend protocol – select HTTP
  • Select Yes for Override with a new hostname
  • Select Pick hostname from the backend target
  • Select Add,

step2f

step2g

  • Select Add to save the path rule and return to the Add a routing rule
  • Repeat to add another rule for images1.
  • Select Add to add the routing rule and return to the Configuration
  • Select Next: Tags and then Next: Review + Create.
  • In the Overview tab of the application gateway, copy the public IP address and paste it into the browser.
  • Change the URL to http://<ip-address>:80/images replace the <ip-address> with the public IP address of application gateway
  • The listener on port 80 routes the request to the Images backend pool

step2h

  • Change the URL to http://<ip-address>:80/images1 replace the <ip-address> with the public IP address of application gateway
  • The listener on port 80 routes the request to the Images1 backend pool

step2i

Comparison between the Azure Container app and AWS ECS

Azure Container App and AWS Elastic Container Service (ECS) are container orchestration platforms, but they have some differences in architecture, deployment, and management.

tabl2

Conclusion

Hence deploying a container app behind an application gateway as a backend pool can be a powerful solution for modern application delivery and deployment, providing improved performance, scalability, and security for your application.

Making IT Networks Enterprise-ready – Cloud Management Services

  • Accelerated cloud migration
  • End-to-end view of the cloud environment
Get Started

About CloudThat

CloudThat is also the official AWS (Amazon Web Services) Advanced Consulting Partner and Training partner and Microsoft gold partner, helping people develop knowledge of the cloud and help their businesses aim for higher goals using best in industry cloud computing practices and expertise. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Our blogs, webinars, case studies, and white papers enable all the stakeholders in the cloud computing sphere.

Drop a query if you have any questions regarding Azure Container App and I will get back to you quickly.

To get started, go through our Consultancy page and Managed Services Package that is CloudThat’s offerings.

FAQs

1. What are the benefits of using a container app behind an application gateway?

ANS: – Using a container app behind an application gateway can provide several benefits, including improved performance, scalability, and security, by leveraging the advanced networking features of the application gateway.

2. How do I monitor the traffic and performance of the container app behind the application gateway?

ANS: – You can monitor the traffic and performance of the container app behind the application gateway by using the application gateway logs and metrics, which provide detailed information on request rates, response times, error rates, and status codes.

WRITTEN BY Abhilasha D

Abhilasha D is a Research Associate-DevOps at CloudThat. She is focused on gaining knowledge of Cloud environment and DevOps tools. She has keen interest in learning and researching on emerging technologies.

Share

Comments

    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!