Deploy a Containerized App to Azure Kubernetes Service
Back to Tutorials
DevOpsIntermediate7 Steps

Deploy a Containerized App to Azure Kubernetes Service

Khawar HabibAugust 5, 202540 min read1 hr 10 min video

Learn to containerize a .NET application with Docker, push it to Azure Container Registry, and deploy it to Azure Kubernetes Service (AKS) with CI/CD.

Introduction

Azure Kubernetes Service (AKS) simplifies deploying and managing containerized applications. This tutorial walks through the entire container lifecycle from Dockerfile to production deployment.

Step 1: Containerize the Application

Create a Dockerfile for your .NET application:

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 8080

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY . .
RUN dotnet publish -c Release -o /app/publish

FROM base AS final
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "MyApp.dll"]

Step 2: Build & Test Locally

docker build -t myapp:v1 .
docker run -p 8080:8080 myapp:v1

Step 3: Push to Azure Container Registry

Create an ACR instance and push your container image to it using the Azure CLI.

Step 4: Create the AKS Cluster

Provision an AKS cluster with the Azure CLI, configure kubectl, and verify connectivity.

Step 5: Write Kubernetes Manifests

Create deployment and service YAML files to describe your application's desired state in Kubernetes.

Step 6: Deploy to AKS

Apply the manifests to your cluster and verify the application is running with a public load balancer.

Step 7: Set Up CI/CD with GitHub Actions

Automate the build, push, and deploy pipeline using GitHub Actions for continuous deployment.

KubernetesAKSDockerCI/CDGitHub ActionsAzure

Share this tutorial

Chapters (7)

  1. 1

    Introduction to AKS

    Overview of Azure Kubernetes Service and containers

    00:00
  2. 2

    Containerize the App

    Write a multi-stage Dockerfile for a .NET app

    05:00
  3. 3

    Build & Test Locally

    Build the Docker image and run it locally

    14:00
  4. 4

    Push to ACR

    Create Azure Container Registry and push the image

    22:00
  5. 5

    Create AKS Cluster

    Provision and configure the Kubernetes cluster

    32:00
  6. 6

    Deploy to Kubernetes

    Write manifests and deploy the application

    45:00
  7. 7

    CI/CD with GitHub Actions

    Automate the pipeline for continuous deployment

    57:00

About the Author

KH

Khawar Habib

Microsoft MVP | AI Engineer

Software & AI Engineer specializing in Microsoft Azure, .NET, and cutting-edge AI technologies.

Need help with your project?

Let's discuss how I can help bring your ideas to life.

Get In Touch