Moving Applications into
Azure Kubernetes
The Azure Group (Azure User Community, Toronto)
About Me
Name : Hussein Salman
Experience: I have over 12 years of experience in software development and architecture
Role: Manager at Avanade
Certifications: PMP, CSM, MCSD, MCSA Cloud and AWS Architect
http://husseinsalman.com
@husseinsalmann
Goals
• Overview of Microservices
• Containerize applications using Docker
• Understand main Kubernetes Objects
• Leverage Azure Services
• Push Docker images into Azure Container Registry
• Deploy application into Azure Kubernetes cluster
What are Microservices?
A software architecture style in
which complex applications are
composed of small,
independent processes
communicating with other using
language-agnostic APIs. These
services are small, highly
decoupled and focus on doing a
small task, facilitating a modular
approach to system-building.
[Figure 1 , martinfowler]
Why complicating things and adopting Microservices architecture
instead of a Monolithic?
Monolithic Architecture Challenges
Scalability is compromised
Lack of Agility
(difficult to understand and modify)
Long-term commitment to
technology stack
Continuous Deployment
(To update one component, you have to
deploy the entire application)
Team Productivity
Reliability
(Single point of failure)
What about Microservice Challenges?
• Debugging is difficult
• Monitoring/Logging is difficult
• Distributed databases make transactions hard
• Distributed services adds more network communication
• Cluster and orchestration tools overhead
• Operational and tooling overhead on dev teams
• Increasing Deployment Complexities
Containers simplifies microservices deployment
What are Containers?
Containers = Operating System Virtualization
Virtual Machines = Hardware Virtualization
[Figure 2 ,docker]
Why Containers?
[Figure 3 ,flipboard.com]
Docker
Leading open-source containerization platform
Docker containers wrap up a piece of software in a
complete filesystem that contains everything it needs to
run: code, runtime, system tools, system libraries –
anything you can install on a server. This guarantees that it
will always run the same, regardless of the environment it
is running in.
Tools: Docker CLI, Docker Engine, Docker Swarm,
Docker Compose
Docker Architecture
[Figure 4 ,docker.com]
Application for the Demo
• Simple App to demonstrate
• Front-end (Angular)
• Back-end API (ASP.NET Core)
Run containerized app locally
Demo 1
What about other distributed systems challenges?
Container Management at Scale
• Where to run the containers?
• How to manage them on multiple hosts?
• What happens if a host is down?
• How to keep them running despite of failure?
• What about scaling?
• How to update them?
• Where are the containers and how to connect?
Elements of Orchestration
Kubernetes Architecture
Kubernetes
Master
Node
Image Registry
Node
Node
UI
CLI
API
Application
Application
Application
Azure Kubernetes Service (AKS)
Managed Kubernetes Cluster in Azure:
• Control Plane Is free
• Pay only for worker nodes
• Same software and tooling for regular
K8
Easily Integrate with Azure Services:
• Security: RBAC and Azure AD integration
• Azure Monitor
• Virtual network integration
• Azure DevOps
Azure Container Registry (ACR)
Geo-replicationManage images for all
types of containers
Keep container
images close
Expand registry
functionality
Kubernetes Key Objects
• Pod
• Replica set
• Deployment
• Service
Node
Pod
Container
Pod 1
Container 1
Pod 2
• The smallest and simplest unit in the Kubernetes
object model in terms of deployment and scaling
• Encapsulates container(s), storage, network IPs, and
deployment options
• Represent a running process in the cluster (Worker
Node)
• A group of one or more containers
• Containers within a pod share an IP address and port
space, and can find each other via localhost
Container 2
Container
Pod 1
Node
Service
front-end
Pod
10.10.10.1
back-end
Pod
10.10.10.2
back-end
Pod
10.10.10.3
back-end
Pod
10.10.10.4
IP: 10.10.10.6
DNS: frontend-svc
Service
IP: 10.10.10.6
DNS: backend-svc
Service
Traffic
• Pod objects are mortal, so we can’t rely on
their IP addresses
• Services defines a logical set of pods and a
policy to access them
• They give pods a stable IP
• A service is a virtual load balancer in front
of pods
IP: 10.10.10.6
DNS: backend-svc
Service
back-end
Pod
10.10.10.3
back-end
Pod
10.10.10.4
BE
1.2
BE
1.2
BE
1.2back-end
Pod
10.10.10.5
BE
1.2
Replica Set
Node
Front-end
Pod B
Front-end
Pod C
Replica Set
Replicas: 3
Template:
Front-end
Pod
Front-end
Pod A
• Ensures high availability
• A higher level concept that manages
multiple instances of the same pod
• Defining container images and how many
pod instances
• Responsible for reconciling desired state
and self-healing
Desired State
3
Actual State
32
Deployment
• A Deployment describes declarative updates for
Pods and Replica Sets
• Application deployment with zero downtime
• Updates happen in rolling fashing
• Deployment’s rollout history is kept in the
system so that you can rollback anytime
Replica Set
Pod
Container
Pod
Container ….
Deployment
Updates & Rollback
Scaling, self-healing
What type of object being defined
Application Yaml Files - Deployment
Pods are labeled app: web-ui
deployment use labels to find & manage pods
Specify instances of pod running
Listen on container port 80
Pull the image and run the container
Podtemplate
Give a name to the deployment
Application Yaml Files - Service
type of object being defined
Give a name to the service
Determine the set of the pods a service can target
us
Map incoming traffic on port 4200 to port 80 on pod
Select the service type
29
Application on Kubernetes
web-ui
port 80
Backend-api
port 80
app=web-uilabel
image azurecr.io/frontend:v1
front-end deployment
web-ui-1
port 80
web-ui-2
port 80
31
port
app=web-uilabel
image azurecr.io/frontend:v1
web-ui-1
port 80
web-ui-2
port 80
front-end service
selector app=web-ui
port
IP
4200:80
10.0.2.20 front-end deployment
How it works together?
[Figure 5, Microsoft]
• Provision AKS
• Authenticate AKS to connect to ACR
• Apply yaml Files
• Run the application
Demo 3 – Run App on AKS
Thank You!
http://husseinsalman.com
@husseinsalmann

Moving Applications into Azure Kubernetes

  • 1.
    Moving Applications into AzureKubernetes The Azure Group (Azure User Community, Toronto)
  • 2.
    About Me Name :Hussein Salman Experience: I have over 12 years of experience in software development and architecture Role: Manager at Avanade Certifications: PMP, CSM, MCSD, MCSA Cloud and AWS Architect http://husseinsalman.com @husseinsalmann
  • 3.
    Goals • Overview ofMicroservices • Containerize applications using Docker • Understand main Kubernetes Objects • Leverage Azure Services • Push Docker images into Azure Container Registry • Deploy application into Azure Kubernetes cluster
  • 4.
    What are Microservices? Asoftware architecture style in which complex applications are composed of small, independent processes communicating with other using language-agnostic APIs. These services are small, highly decoupled and focus on doing a small task, facilitating a modular approach to system-building. [Figure 1 , martinfowler]
  • 5.
    Why complicating thingsand adopting Microservices architecture instead of a Monolithic?
  • 6.
    Monolithic Architecture Challenges Scalabilityis compromised Lack of Agility (difficult to understand and modify) Long-term commitment to technology stack Continuous Deployment (To update one component, you have to deploy the entire application) Team Productivity Reliability (Single point of failure)
  • 7.
    What about MicroserviceChallenges? • Debugging is difficult • Monitoring/Logging is difficult • Distributed databases make transactions hard • Distributed services adds more network communication • Cluster and orchestration tools overhead • Operational and tooling overhead on dev teams • Increasing Deployment Complexities
  • 8.
  • 9.
    What are Containers? Containers= Operating System Virtualization Virtual Machines = Hardware Virtualization [Figure 2 ,docker]
  • 10.
  • 11.
    Docker Leading open-source containerizationplatform Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in. Tools: Docker CLI, Docker Engine, Docker Swarm, Docker Compose
  • 12.
  • 13.
    Application for theDemo • Simple App to demonstrate • Front-end (Angular) • Back-end API (ASP.NET Core)
  • 14.
    Run containerized applocally Demo 1
  • 15.
    What about otherdistributed systems challenges?
  • 16.
    Container Management atScale • Where to run the containers? • How to manage them on multiple hosts? • What happens if a host is down? • How to keep them running despite of failure? • What about scaling? • How to update them? • Where are the containers and how to connect?
  • 17.
  • 19.
  • 20.
    Azure Kubernetes Service(AKS) Managed Kubernetes Cluster in Azure: • Control Plane Is free • Pay only for worker nodes • Same software and tooling for regular K8 Easily Integrate with Azure Services: • Security: RBAC and Azure AD integration • Azure Monitor • Virtual network integration • Azure DevOps
  • 21.
    Azure Container Registry(ACR) Geo-replicationManage images for all types of containers Keep container images close Expand registry functionality
  • 22.
    Kubernetes Key Objects •Pod • Replica set • Deployment • Service
  • 23.
    Node Pod Container Pod 1 Container 1 Pod2 • The smallest and simplest unit in the Kubernetes object model in terms of deployment and scaling • Encapsulates container(s), storage, network IPs, and deployment options • Represent a running process in the cluster (Worker Node) • A group of one or more containers • Containers within a pod share an IP address and port space, and can find each other via localhost Container 2 Container Pod 1
  • 24.
    Node Service front-end Pod 10.10.10.1 back-end Pod 10.10.10.2 back-end Pod 10.10.10.3 back-end Pod 10.10.10.4 IP: 10.10.10.6 DNS: frontend-svc Service IP:10.10.10.6 DNS: backend-svc Service Traffic • Pod objects are mortal, so we can’t rely on their IP addresses • Services defines a logical set of pods and a policy to access them • They give pods a stable IP • A service is a virtual load balancer in front of pods IP: 10.10.10.6 DNS: backend-svc Service back-end Pod 10.10.10.3 back-end Pod 10.10.10.4 BE 1.2 BE 1.2 BE 1.2back-end Pod 10.10.10.5 BE 1.2
  • 25.
    Replica Set Node Front-end Pod B Front-end PodC Replica Set Replicas: 3 Template: Front-end Pod Front-end Pod A • Ensures high availability • A higher level concept that manages multiple instances of the same pod • Defining container images and how many pod instances • Responsible for reconciling desired state and self-healing Desired State 3 Actual State 32
  • 26.
    Deployment • A Deploymentdescribes declarative updates for Pods and Replica Sets • Application deployment with zero downtime • Updates happen in rolling fashing • Deployment’s rollout history is kept in the system so that you can rollback anytime Replica Set Pod Container Pod Container …. Deployment Updates & Rollback Scaling, self-healing
  • 27.
    What type ofobject being defined Application Yaml Files - Deployment Pods are labeled app: web-ui deployment use labels to find & manage pods Specify instances of pod running Listen on container port 80 Pull the image and run the container Podtemplate Give a name to the deployment
  • 28.
    Application Yaml Files- Service type of object being defined Give a name to the service Determine the set of the pods a service can target us Map incoming traffic on port 4200 to port 80 on pod Select the service type
  • 29.
  • 30.
  • 31.
    31 port app=web-uilabel image azurecr.io/frontend:v1 web-ui-1 port 80 web-ui-2 port80 front-end service selector app=web-ui port IP 4200:80 10.0.2.20 front-end deployment
  • 32.
    How it workstogether? [Figure 5, Microsoft]
  • 33.
    • Provision AKS •Authenticate AKS to connect to ACR • Apply yaml Files • Run the application Demo 3 – Run App on AKS
  • 34.