Azure ACS and Kubernetes: Microservices On Steroids
Alexander Zeitler
CEO / Solution Architect at PDMLab
Microsoft MVP / ASP.NET since 2004
ASP.NET Web API Advisor since 2011
Microsoft Azure Advisor since 2014
Organizer of Azure Meetup Karlsruhe
Using Docker since 2013
https://pdmlab.com
alexander.zeitler@pdmlab.com
@alexzeitler_
Agenda
- Microservices
- Challenges
- Docker
- Azure ACS / Kubernetes
Microservices
Microservices is a variant of the service-oriented architecture (SOA) architectural style that structures an application as a collection of loosely coupled services.
Microservices-based architectures enable continuous delivery and deployment.
In a microservices architecture, services should be fine-grained and the protocols should be lightweight. The benefit of decomposing an application into different smaller services is that it improves modularity and makes the application easier to understand, develop and test.
The benefit of decomposing an application into different smaller services is that it improves modularity and makes the application easier to understand, develop and test. It also parallelizes development by enabling small autonomous teams to develop, deploy and scale their respective services independently
Example: E-Commerce
- Web Front-End
- Product Data Management (PDM)
- Warehouse
- Purchasing
- Logistics
- Payment
- Billing
- Identity
Principles
- Focus on a single Domain
- Two Pizza Rule
- Autonomous
- Small
- Shared Nothing (Exclusive State)
- Async
Advantages
- Cross Platform
- Easier Replacement / Refactoring
- Decoupled Deployment
- Code Ownership
Challenge: Complexity
Complexity
- Significant Operations Overhead
- Substantial DevOps Skills Required
- Implicit Interfaces
- Duplication Of Effort
- Distributed System Complexity
- Asynchronicity Is Difficult!
- Testability Challenges
Challenge: Deployment
Automate Deployment!
Deployment
- Fast
- Reliable
- Repeatable
The perfect deployment?
Build, ship and run any application anywhere
vs...
Put it in a container
Build
package application in a container image
Ship
Move container image to another machine
Run
Execute container(s) based on image
Anywhere
Any Application
Build
FROM ubuntu:16.04
MAINTAINER Alexander Zeitler <alexander.zeitler@pdmlab.com>
RUN apt-get update
RUN apt-get install -y nginx
RUN echo 'Hi, I am your father...erm in your container' \
>/usr/share/nginx/html/index.html
CMD [ "nginx", "-g", "daemon off;" ]
EXPOSE 80
Ship
Image name <username>/<reponame>
e.g. microsoft/dotnet
docker push
docker pull
Docker ecosystem
Engine
Compose
Hub
Machine
Swarm
Registry
Cloud
Run
docker run ubuntu echo hello world
Containers in Azure
Azure Container Service
Kubernetes
Greek for "Helmsman"
The person who steers a ship
ACS Orchestrators
Docker Swarm
Mesos / DC/OS
Kubernetes
Invented by Google
Borg
Omega
Kubernetes == k8s
HTTPS
KV
Auth
Db
Log
Messaging
LB
Orders
k8s Architecture
HTTPS
KV
Auth
Db
Log
Messaging
LB
Orders
HTTPS
KV
Auth
Db
Log
Messaging
LB
Orders
Node 1
Node 2
Node 3
{ /*App*/}
Master
Master
Master
Node
Node
Node
Node
Node
Node
Deployment
Pods
Pods
Pods
{ /*App*/}
Master
Master
Master
Node
Node
Node
Node
Node
Node
Master
Node
Linux
Linux
Node
Linux
Node
Linux
Env
Env
Env
Env
k8s Masters
Master
Linux
Env
KV
apiserver
kube-apiserver
Front end to control plane
REST-API
JSON (manifest files)
KV Store
persistent
state config of the cluster
Uses etcd
CM
Controller Manager
Node Controller
Endpoints Controller
Namespace Controller
kube-scheduler
watches apiserver
Assigns work to nodes
Master
KV
apiserver
CM
kubectl
apiserver
Commands (JSON)
Node
Node
Node
k8s Nodes
Node
Linux
Env
Kubelet
kubernetes agent
registers node with cluster
watches apiserver
instantiates pods
reports to master
endpoint at port :10225
/spec
/healthz
/pods
Container Runtime
pull images
start / stop containers
Docker or rkt
kube-proxy
Networking
Assign IP to Pod
All containers in a Pod share IP
LB across Pods in services
K
CR
P
Desired State
Master
KV
apiserver
CM
kubectl
apiserver
Manifest file (JSON/YAML)
Node
Node
Node
Master
KV
apiserver
CM
kubectl
apiserver
Manifest file (JSON/YAML)
Node
Node
Node
Pod
Pod
Pod
3 x nginx
nginx
nginx
nginx
Desired State:
Master
KV
apiserver
CM
kubectl
apiserver
Manifest file (JSON/YAML)
Node
Node
Node
Pod
Pod
Pod
3 x nginx
nginx
nginx
nginx
Desired State:
Master
KV
apiserver
CM
kubectl
apiserver
Manifest file (JSON/YAML)
Node
Node
Pod
Pod
3 x nginx
nginx
nginx
Pod
Desired State:
Pods
Unit of scale
Pod
Pods
Pod
link
net
trnsprt
IPC
mount
Environment
Namespaces
Network stack
...
n Containers
Scaling
Pod
Pod
Pod
Pod
Coupling
Pod
App
AI-Log
Pods are atomic
containers not up == pod n/a
Pod lifecycle
born - alive - dead
Pod Deployment
"manually"
Manifest
Services
Pod
Pod
Pod
Pod
Pod
10.244.2.4
10.244.2.5
10.244.2.6
10.244.2.6
10.244.2.6
Service
10.244.2.10
DNS: db.myapp
Labels
Pod
Pod
Pod
Pod
Pod
10.244.2.4
10.244.2.5
10.244.2.6
10.244.2.6
10.244.2.6
Service
10.244.2.10
DNS: db.myapp
p
p
p
p
p
p
db
db
lb
Deployments
Deployments
Manifest files (YAML/JSON)
Rolling updates + rollbacks
Multiple concurrent versions
blue-green-deployment
Canary releases
Demo
Thanks!
Azure Meetup KA - Azure ACS and Kubernetes
By Alexander Zeitler
Azure Meetup KA - Azure ACS and Kubernetes
- 789