During Ignite 2021, Microsoft announced the public preview of Azure Container Apps, a fully managed serverless container runtime for building and running modern applications at scale.
This article gives you a brief introduction to what Azure Container Apps is, which technologies are used to provide this fantastic serverless container runtime and how you can build and run containerized workloads on Azure Container Apps
What is Azure Container Apps
Kubernetes is the most powerful application platform for containerized workloads (orchestrator) these days. However, it is complex. Developers have to master the initial, steep learning curve before taking full advantage of all the features offered by Kubernetes. Azure Container Apps is here to remove the steep learning curve.
Azure Container Apps is an abstraction layer on top of Kubernetes, a fully managed service to run containerized workloads. It allows you to focus on building applications instead of managing, configuring, and hardening the underlying Kubernetes cluster. Although Azure Container Apps is an abstraction layer, we still get all the shiny benefits Kubernetes offers. Azure Container Apps is not just a managed Kubernetes.
Scaling in Azure Container Apps with KEDA
Kubernetes Event-driven Autoscaling (KEDA) builds the basement for all-the-things scaling in Azure Container Apps. Whether you want to scale on compute metrics such as memory or CPU allocation or if you have to scale a specific workload based on messages being stored in a queue.
I have been working with KEDA for some years now. Being able to scale on domain-specific data, events, metrics made using, teaching and adopting KEDA fun.
Microservice in Azure Container Apps with Dapr
Distributed Application Runtime (dapr) let you build and connect microservices with ease. Dapr allows you to build loosely-coupled microservice architectures instead of creating the next distributed monolith.
In Azure Container Apps we leverage Dapr and its components to build applications with resilience, scalability, and loose coupling in mind.
Advanced network capabilities with Envoy
Incoming HTTP requests are routed through an Envoy proxy, mostly hidden from us as users of Azure Container Apps. However, having a powerful proxy as part of the platform allows us to configure (not implement) powerful features such as traffic splitting to get blue/green deployments and A/B testing in almost no time.
Upgrade to full-fledged Azure Kubernetes Service
You can upgrade from Azure Container Apps to full-fledged Azure Kubernetes Service (AKS) at any time and unleash the full power of Kubernetes.
Core Components of Azure Container Apps
Azure Container Apps comes with a handful of components that we have to understand and leverage to build enterprise-degree cloud-native applications.
Containers in Azure Container Apps
We can run containers in Azure Container Apps. It can consume those containers from public registries like Docker Hub or private registries like Azure Container Registry (ACR). When consuming container images from private registries, corresponding credentials must be provided as part of the application template.
We do not deploy containers directly. Like Kubernetes, Azure Container Apps uses Pods as an atomic vehicle to run containers. We can define Pods to consist of multiple containers. In Kubernetes, we call this sidecar pattern. All containers of a Pod share hard disk and network resources. Currently, Azure Container Apps supports Linux-based containers only.
Revisions in Azure Container Apps
A revision represents an immutable snapshot of a Pod. There is at least one revision, which is created automatically during initial deployment. Typically, we will have multiple revisions of a Pod at a certain point in time to provide A/B testing or Blue/Green deployments.
New revisions will be generated automatically when containers change or modifications are made to the
template section of a Pod.
Consider reviewing the different change types, to understand which modifications will result in new revisions being created automatically.
Container Apps in Azure Container Apps
A container app consists of at least one revision. Every container app can have active and inactive revisions. However, it has at least one active revision. If a revision is not needed anymore, we can deactivate the revision. (We can also re-activate inactive revisions)
Environments in Azure Container Apps
An environment consists of at least one container app. Every environment acts as a security boundary, which means all its container apps are deployed into a dedicated Azure Virtual Network. All logs produced from containers inside of the environment are sent to a dedicated Azure Log Analytics Workspace.
Hands-On: Getting started with Azure Container Apps
Okay, we have briefly talked about what Azure Container Apps are and which technologies are used under the hood. Now it is time to do some hands-on and deploy a simple container to Azure Container Apps.
Install Azure Container Apps extension for Azure CLI
First, we have to install the Azure Container Apps extension for Azure CLI. Once we have installed the extension, we will have access to the
az containerapp sub-command.
# install Azure Container Apps CLI extension az extension add \ --source https://workerappscliextension.blob.core.windows.net/azure-cli-extension/containerapp-0.2.0-py2.py3-none-any.whl
Create an Azure Container App environment with Azure CLI
The following snippet creates all necessary components, including Azure Resource Group and Azure Log Analytics Workspace. You can modify the deployment by changing the variables located at the beginning of the snippet:
# variables location="northeurope" rgName="rg-blog-sample2" lawName="law-blog-sample2" containerAppEnvName="blog-sample2" # Create Resource Group az group create -n $rgName -l $location # Create Log Analytics Workspace az monitor log-analytics workspace create \ -n $lawName \ -g $rgName # Grab Log Analytics Workspace ClientId lawClientId=$(az monitor log-analytics workspace show \ --query customerId \ -g $rgName \ -n $lawName \ --out tsv) # Grab Log Analytics Workspace ClientSecret lawClientSecret=$(az monitor log-analytics workspace get-shared-keys --query primarySharedKey \ -g $rgName \ -n $lawName \ --out tsv) # Create Azure Container App Environment az containerapp env create \ -n $containerAppEnvName \ -g $rgName \ --logs-workspace-id $lawClientId \ --logs-workspace-key $lawClientSecret \ -l $location
Deploy a Container to Azure Container Apps with Azure CLI
Now that we have an environment in place, we can deploy a container app. For demonstration purpose, we will use plain old NGINX from Docker Hub for now:
# Deploy NGINX to Azure Container Apps az containerapp create \ -n sample-nginx\ -g $rgName\ --environment $containerAppEnvName\ --image nginx:latest \ --target-port 80 \ --ingress 'external' \ --query configuration.ingress.fqdn
This command will print the FQDN, which we can use in the browser to access NGINX using it’s public address.
Currently, Azure Container Apps is available in North Europe (
northeurope) and Canada Central (
As of today (2nd of November 2021), Azure Container Apps is available in public preview. Although you can use a public preview service to run your workloads, you should be aware that things may change until the service reaches GA. Also, notice that there is no service level agreement (SLA) for services being available in public preview.
Let’s face it. Kubernetes is hard. This is especially true for newcomers or developers who want to focus on solving business requirements instead of tackling and mastering the underlying application platform. With the rise of Azure Container Apps, teams and individual developers can remain focussed on solving business requirements and deploy cloud-native applications with ease to a fully-managed service offering.
Especially teams facing a modernization and planning their move to Azure Kubernetes Service may be interested in Azure Container Apps. The possibility of upgrading from Azure Container Apps to full-fledged Azure Kubernetes Service could minimize initial training efforts and release faster cadence.
IMO Azure Container Apps is a perfect addition to Azure’s container landscape and will face a massive adoption once it becomes GA. I will revisit some of my projects and port them to Azure Container Apps.
If you want to learn more about Azure Container Apps, consult the official documentation for the public preview.