Back to: Microsoft Azure Tutorials
Kubernetes and Azure Kubernetes Service (AKS) Fundamentals
In the previous chapters, we learned how to containerize an ASP.NET Core Web API using Docker and deploy it on Azure App Service. This approach works very well for small and medium-sized applications. For example, if we have a single Web API application and want to run it inside a container, Docker and Azure App Service are often sufficient.
However, as applications grow and start handling thousands or millions of users, managing containers manually becomes difficult. Applications may require:
- Multiple services
- High availability
- Automatic scaling
- Rolling updates for deploying new versions with minimal or no downtime
- Better monitoring
- Faster recovery from failures
This is where Kubernetes becomes very important. Kubernetes helps us manage containerized applications automatically. It helps with scaling, load balancing, restarting failed containers, updating applications without downtime, and managing communication between services.
In this chapter, we will understand Kubernetes and Azure Kubernetes Service (AKS) from a beginner-friendly perspective. We will not deploy an application in this chapter. We will first understand:
- Why Kubernetes is needed
- What problems Kubernetes solves
- How Kubernetes works
- What AKS is
- How Docker, Kubernetes, and AKS are connected
Why is Kubernetes needed after Docker?
Docker is a very powerful tool that helps us package applications into containers. A Docker container contains:
- Application code
- Runtime
- Dependencies
- Libraries
- Configuration
This means the same application can run consistently on:
- Developer machines
- Testing environments
- Staging servers
- Production servers
For example, in our ASP.NET Core Web API project:
- Docker creates an image for the Web API.
- The image contains everything needed to run the application.
- We can run that image as a container anywhere.
For small applications, running one or two containers manually is manageable. But problems start when the application grows. For a better understanding, please have a look at the following image.

Real-Time Problems in Large Applications
Suppose our application becomes very popular. Then we may need:
- 10 or 20 copies of the same Web API
- Multiple microservices such as Product Service, Order Service, Payment Service, and Notification Service
- Automatic restart when a container fails
- Load balancing between multiple containers
- Deployment with minimal or no downtime
- Automatic scaling during high traffic
- Rolling updates when a new version is released
- Secure configuration and secret management
- Proper communication between services
Docker alone cannot manage all these things automatically.
Docker is excellent for:
- Creating containers
- Running containers
But Docker alone is not enough for managing hundreds or thousands of containers in production. We need automation. We need a system that can:
- Monitor containers
- Restart failed containers
- Scale applications automatically when autoscaling rules are configured
- Distribute traffic
- Handle updates safely
- Keep applications always available
That system is Kubernetes.
Simple Understanding
You can understand the difference like this:
- Docker is used to package and run applications inside containers.
- Kubernetes manages containers at scale.
Real-Life Analogy: Docker and Kubernetes
Think of Docker as a lunch box. A lunch box packages food properly so that we can carry it anywhere. Similarly, Docker packages our application with everything required to run it properly.
Now imagine a large school where thousands of students need lunch every day. Having lunch boxes is not enough. Someone must manage:
- Distribution to students
- Availability
- Replacement if something is missing
- Timing
- Delivery
That complete management system is like Kubernetes. So:
- Docker packages the application.
- Kubernetes manages how that packaged application runs in a large environment.
Key Points to Remember:
- Docker is used to package applications into containers.
- Docker makes the application portable across environments.
- Docker is good for creating and running containers.
- Docker alone is not enough for large-scale production management.
- Kubernetes manages containers automatically.
- Kubernetes helps with scaling, availability, recovery, and deployment.
- Kubernetes becomes useful when applications grow and need automation.
What is Container Orchestration?
Before understanding Kubernetes deeply, we need to understand the term container orchestration. The word orchestration means coordination and management.
When we have only one container, manual management is easy. But when we have many containers running across multiple servers, manual management becomes difficult. Container orchestration is the automatic management of containerized applications.
It includes:
- Starting containers
- Stopping containers
- Restarting failed containers
- Running multiple copies of the same application
- Distributing traffic between containers
- Scaling containers up or down
- Updating applications safely
- Managing communication between services
- Managing configuration and secrets
Kubernetes is a container orchestration platform. It acts like a coordinator for containers. Kubernetes decides:
- Where a container should run
- How many copies of the container should run
- What should happen if a container fails
- How users should access the application
- How traffic should be distributed
- How the configuration should be provided
- How secrets should be passed securely
- How application updates should happen safely
Container orchestration is the process of managing containers automatically in a large environment. So, in simple words, container orchestration means:
- Automatic deployment
- Automatic scaling
- Automatic recovery
- Automatic networking
- Automatic management of containers
Kubernetes is one of the most popular container orchestration platforms. For a better understanding, please have a look at the following image:

Real-Life Analogy
Think of a big marriage function. In a marriage function, many teams are involved:
- Decorators
- Cooks
- Waiters
- Photographers
- Guests
- Parking staff
- Security staff
If everyone works independently without coordination, the event becomes confusing.
Someone must decide:
- Who works where
- How many waiters are needed
- What to do if food is delayed
- How to handle more guests
- How to manage parking
- How to guide guests to the correct place
That coordinator is like Kubernetes. Kubernetes coordinates containers. It decides where containers should run, how many should run, what to do if one fails, and how traffic should be distributed.
Key Points to Remember:
- Orchestration means coordination and management.
- Container orchestration means managing containers automatically.
- Kubernetes is a container orchestration platform.
- Kubernetes reduces manual work in production environments.
- Kubernetes is useful when many containers need to run together.
What is Kubernetes?
Kubernetes, also known as K8S, is an open-source container orchestration platform. In simple terms, Kubernetes is a system that automatically manages containerized applications. Kubernetes helps us:
- Deploy containerized applications
- Run multiple copies of an application
- Restart failed containers
- Scale applications
- Distribute traffic
- Update applications safely
- Manage service communication
- Keep applications highly available
Kubernetes does not create container images. Docker or other image-building tools are used to create container images. For example:
- Docker can create an image of our ASP.NET Core Web API.
- The image can be stored in a container registry such as Azure Container Registry.
- Kubernetes can pull that image and run it as containers.
So, Docker creates the container image, and Kubernetes manages how that image runs in production. For a better understanding, please have a look at the following image

When we use Docker, we usually think like this:
- Run one container of my ASP.NET Core Web API.
But when we use Kubernetes, we think like this:
- I want three running copies of my ASP.NET Core Web API.
- If one copy fails, create another copy automatically.
- If traffic comes, distribute it between all running copies.
- If a new version is released, update the application safely.
- If traffic increases, increase the number of running copies.
This is the main difference between simply running containers and managing containers at scale.
Simple Example
Suppose we have an ASP.NET Core Web API Docker image stored in Azure Container Registry.
Kubernetes can:
- Pull that image from Azure Container Registry.
- Run the image as a container.
- Create multiple copies of that container.
- Restart the container if it fails.
- Expose the application to users.
- Distribute traffic between multiple copies.
- Update the application when a new image version is available.
So, Kubernetes makes container management much easier in production.
Real-Life Analogy: Kubernetes
Think of Kubernetes as the manager of a large shopping mall. A mall has many things:
- Shops
- Security guards
- Cleaning staff
- Electricians
- Customers
- Entry gates
- Emergency systems
The mall manager does not sell products in every shop. Instead, the manager ensures that:
- Shops are open
- Electricity is available
- Security is active
- Cleaning is done
- Customers can enter properly
- Problems are handled quickly
Similarly, Kubernetes does not create the application. Docker creates the container image. Kubernetes manages how those containers run in production.
Key Point to Remember:
- Kubernetes is also called K8s.
- Kubernetes is an open-source container orchestration platform.
- Kubernetes manages containerized applications.
- Kubernetes does not create Docker images.
- Kubernetes uses container images and runs them in a managed way.
- Kubernetes is mainly used in production-grade systems.
- Kubernetes helps with deployment, scaling, availability, and recovery.
What Problems Does Kubernetes Solve?
Kubernetes solves many real-world problems that appear when applications become large. Let us understand the major problems one by one.
1. Container Failure
In production, containers may fail for many reasons.
For example:
- Application error
- Memory issue
- Server issue
- Configuration issue
- Network issue
- Dependency failure
If we manage containers manually, someone must check the failed container and restart it. Kubernetes does this automatically. If a container or Pod fails, Kubernetes can restart it or create a replacement Pod based on the configured workload, restart policy, and health checks.
2. Scaling
As more users use our application, a single container may not be enough. For example, during festival offers or sale periods, an e-commerce application may receive heavy traffic. In that case, we need more running copies of the same application. Kubernetes can run multiple copies of the same container and distribute traffic between them. This helps the application handle more users.
3. Load Balancing
When multiple copies of the same application are running, user requests should not go to only one container. The traffic should be distributed properly. Kubernetes provides load balancing so that requests can be distributed across multiple running containers. This improves performance and availability.
4. Deployment Management
In real applications, we frequently release new versions. For example:
- Bug fixes
- New features
- Security updates
- Performance improvements
If we completely stop the old version and then start the new version, users may experience downtime. Kubernetes supports rolling updates. That means Kubernetes gradually replaces the old version with the new version. This helps us update the application safely without stopping everything at once.
5. High Availability
Production applications should be available most of the time. If one container fails, the application should not go down. Kubernetes ensures that the required number of application instances are always running. For example, if we tell Kubernetes that we need three copies of our Web API, Kubernetes will try to maintain three running copies. If one copy fails, Kubernetes creates another copy.
6. Service Discovery and Communication
In a microservices architecture, one service needs to communicate with another service. For example:
- Order Service may call Product Service.
- Payment Service may call Order Service.
- Notification Service may send messages after payment success.
Kubernetes provides internal networking and service names, enabling services to communicate easily. Instead of remembering IP addresses, services can communicate using service names. For a better understanding, please have a look at the following image.

Real-Life Analogy: Problems Solved by Kubernetes
Think of an online food delivery company.
- If one delivery person is unavailable, another delivery person should take the order.
- If there are more orders during lunchtime, more delivery people should be assigned.
- If a new restaurant is added, the system should route orders properly.
- If one area has high demand, more people should be sent there.
This is similar to what Kubernetes does for containers.
- Failed container? Restart or replace it.
- High traffic? Run more copies.
- New version? Update safely.
- Multiple services? Manage communication.
- Users need access? Route traffic properly.
Key Points to Remember:
- Kubernetes automatically restarts failed containers.
- Kubernetes can run multiple copies of an application.
- Kubernetes distributes traffic between containers.
- Kubernetes helps deploy new versions safely.
- Kubernetes keeps applications highly available.
- Kubernetes helps microservices communicate with each other.
What Is Azure Kubernetes Service?
Azure Kubernetes Service (AKS) is Microsoft Azure’s managed Kubernetes service. In simple words, AKS allows us to run Kubernetes on Azure without manually managing the full Kubernetes infrastructure.
Normally, setting up Kubernetes manually is complex. We need to manage many things:
- Control plane
- Worker nodes
- Cluster setup
- Networking
- Security patches
- Scaling
- Monitoring
- Cloud integration
- Identity and access
This requires good infrastructure knowledge. AKS simplifies this. With AKS, Microsoft Azure manages much of the Kubernetes control plane complexity for us. We can focus more on deploying and managing our applications.
For example, suppose:
- We push our ASP.NET Core Web API Docker image to Azure Container Registry.
AKS can:
- Pull that image
- Run it inside Pods
- Scale the application based on configured scaling rules
- Expose it to users
- Manage updates
For a better understanding, please have a look at the following image:

Why Use AKS?
AKS is useful because it makes Kubernetes easier to use on Azure. It is helpful when we are building:
- Microservices-based applications
- Containerized ASP.NET Core Web APIs
- Applications that need high availability
- Applications that need scaling
- Applications that need rolling updates
- Cloud-native applications
- Applications that need integration with Azure services
AKS integrates well with:
- Azure Container Registry
- Azure Monitor
- Azure Virtual Network
- Azure Identity
- Azure Key Vault
- Azure DevOps
- GitHub Actions
Real-Life Analogy: AKS
AKS is like opening a shop inside a managed shopping mall. If we open a shop on our own land, we must manage everything ourselves:
- Building maintenance
- Security
- Electricity
- Parking
- Cleaning
- Water supply
- Basic infrastructure
But if we open a shop in a managed shopping mall, the mall management handles many of the infrastructure responsibilities.
We can focus more on:
- Our shop
- Our products
- Our staff
- Our customers
- Our business
Similarly, if we manage Kubernetes manually, we must handle many infrastructure responsibilities. With AKS, Azure manages much of the Kubernetes complexity, and we can focus more on deploying and managing our applications.
Key Points to Remember:
- AKS stands for Azure Kubernetes Service.
- AKS is Azure’s managed Kubernetes service.
- AKS reduces Kubernetes infrastructure management complexity.
- AKS allows us to run containerized applications on Azure.
- AKS integrates well with other Azure services.
- AKS is useful for production-grade cloud-native applications.
Docker vs Kubernetes vs AKS
Docker, Kubernetes, and AKS are related but not the same. Each one solves a different problem.
- Docker is used to package and run applications inside containers.
- Kubernetes is used to manage many containers in a production environment.
- AKS is Azure’s managed Kubernetes platform.
We can understand them like this:
- Docker answers this question: How do I package and run my application inside a container?
- Kubernetes answers this question: How do I manage many containers automatically in production?
- AKS answers the question: How do I easily use Kubernetes on Microsoft Azure?
For example:
- Docker creates the ASP.NET Core Web API image.
- Docker can run the Web API container.
- Kubernetes can run multiple replicas of that container.
- Kubernetes can restart failed Pods.
- Kubernetes can expose the application using Services.
- Kubernetes can scale the application.
- Kubernetes can manage rolling updates.
- AKS provides managed Kubernetes infrastructure on Azure.
Kubernetes does not replace Docker concepts. Kubernetes uses container images and manages containerized workloads more effectively in production. For a better understanding, please have a look at the following image:

Real-Life Analogy
Let us compare Docker, Kubernetes, and AKS with a restaurant example.
Docker:
Docker is like a food parcel box. It packages the food properly so that it can be delivered anywhere.
Kubernetes:
Kubernetes is like the restaurant manager. The manager decides:
- How many cooks are needed
- How many orders are pending
- What to do if one cook is unavailable
- How to handle peak-hour customers
- How to distribute work
AKS:
AKS is like running that restaurant inside a managed food court. The food court management handles:
- Electricity
- Basic infrastructure
- Security
- Common facilities
- Maintenance
The restaurant owner can focus more on food and customers.
Similarly:
- Docker packages the application.
- Kubernetes manages containers.
- AKS provides managed Kubernetes infrastructure on Azure.
Key Points to Remember:
- Docker is for containerization.
- Kubernetes is for container orchestration.
- AKS manages Kubernetes on Azure.
- Docker packages the application.
- Kubernetes manages the application containers.
- AKS simplifies Kubernetes infrastructure management on Azure.
Simple ASP.NET Core Web API Example
Let us understand the complete idea using our ASP.NET Core Web API example.
- First, we create an ASP.NET Core Web API application.
- Then, we create a Dockerfile for the application.
- Using Docker, we build a Docker image.
- After building the image, we push it to Azure Container Registry.
- Now, instead of running only one container manually, we use Kubernetes or AKS.
In AKS, we can say:
- Run three Pods of this Web API.
- Use the image from Azure Container Registry.
- Restart the Pod if it fails.
- Expose the application using a Kubernetes Service.
- Allow users to access the API from outside.
- Scale the application when traffic increases.
- Update the application when a new version is released.
FAQs
Question 1: Does Kubernetes replace Docker?
No. Kubernetes does not replace Docker concepts. Docker is used to build and package container images. Kubernetes uses those images and manages containers at scale.
Question 2: Does Kubernetes create Docker images?
No. Kubernetes does not create Docker images. Images are created using tools like Docker, BuildKit, or Azure Container Registry Tasks. Kubernetes pulls images from a container registry and runs them.
Question 3: Is AKS different from Kubernetes?
AKS is not a different technology from Kubernetes. AKS is Kubernetes provided as a managed service by Microsoft Azure. That means AKS provides us with Kubernetes, while Azure manages much of the infrastructure complexity.
Question 4: Do we need Kubernetes for every application?
No. Kubernetes is not required for every application. For small applications, Azure App Service or a single Docker container may be enough. Kubernetes is useful when the application needs:
- Scaling
- High availability
- Multiple services
- Automated recovery
- Rolling updates
- Production-grade container management
Conclusion
In this chapter, we learned:
- Why Kubernetes is needed after Docker
- What container orchestration means
- What Kubernetes is
- What problems Kubernetes solves
- What Azure Kubernetes Service (AKS) is
- The difference between Docker, Kubernetes, and AKS
In simple words: Docker packages the application, Kubernetes manages the containers, and AKS makes Kubernetes easier to run on Microsoft Azure.
