48. Containers on Hosts
Host 1
Host 2
Host 3
A host is a server – e.g. EC2 virtual machine.
We run these hosts together as a cluster.
Web App
To start let’s run a 3 copies of our web
app across our cluster of EC2 hosts.
3x
Our simple example web application is
already containerized.
Cluster
49. Run n containers
Host 1
Host 2
Host 3
We define a deployment and set the replicas
to 3 for our container.
deploymentkubectl
rep = 3
50. Scale up!
Host 1
Host 2
Host 3
Need more containers?
Update the replication set!
deploymentkubectl
rep = 5
The new containers are started on the cluster.
51. Untimely termination
Host 1
Host 2
Host 3
Oh no! Our host has died!
Replication
set
rep = 5
Kubernetes notices only 3 of the 5
containers are running and starts 2
additional containers on the remaining
hosts.
57. Services
One of the ways traffic gets to your containers.
• Internal IP addresses are assigned to each container
• Services are connected to containers
and use labels to reference which containers
to route requests to
IP
IP
IP
Service
IP
58. Deployments
IP
IP
IP
Service
IPReplication set
version = 1
count = 3
Deployment
Services work with deployments to manage
updating or adding new pods.
Let’s say we want to deploy a new version of our
web app as a ‘canary’ and see how it handles
traffic.
60. Deployments – Rolling Update
IP
IP
IP
Service
IPReplication set
version = 1
count = 3
Only after the new pod returns a healthy
status to the service do we add more new
pods and scale down the old.
Replication set
version = 2
count = 1
IP
Deployment
Replication set
version = 1
count = 0
Replication set
version = 2
count = 3
62. Deployments – Canary
Service
app=nginx
Version=1
IP
Replication set
app=nginx
version=1
count=3
Deployment
Replication set
app=nginx
version=2
count=1
Deployment
Service
app=nginx
Replication set
app=nginx
version=2
count=2
Replication set
app=nginx
version=1
count=2
Replication set
app=nginx
version=1
count=1
Replication set
app=nginx
version=2
count=3
78. Containers options on AWS – over time
Docker
Host
AWS Cloud
AWSmanagedCustomermanaged
79. Containers options on AWS – over time
Amazon ECS
EC2 Container
Instances
Auto Scaling group
2015
ECS API
Docker
Host
AWS Cloud
AWSmanagedCustomermanaged
80. Containers options on AWS – over time
AWS Fargate
Amazon ECS
EC2 Container
Instances
Auto Scaling group
2017
ECS API
Docker
Host
AWS Cloud
AWSmanagedCustomermanaged
81. Containers options on AWS – over time
AWS Fargate
Amazon ECS
EC2 Container
Instances
Auto Scaling group
Worker
nodes
Auto Scaling groupDIY K8S
ECS API
K8s API
Docker
Host
AWS Cloud
AWSmanagedCustomermanaged
82. Containers options on AWS – over time
AWS Fargate
Amazon ECSAmazon EKS
EC2 Container
Instances
Auto Scaling group
Worker
nodes
Auto Scaling groupDIY K8S
2018
K8s API ECS API
K8s API
Docker
Host
AWS Cloud
AWSmanagedCustomermanaged
85. Containers options on AWS – over time
AWS Fargate
Amazon ECSAmazon EKS
EC2 Container
Instances
Auto Scaling group
Managed
Node Groups
Auto Scaling group
Worker
nodes
Auto Scaling groupDIY K8S
2019
K8s API ECS API
K8s API
Docker
Host
AWS Cloud
AWSmanagedCustomermanaged
86. Containers options on AWS – over time
AWS Fargate
Amazon ECSAmazon EKS
EC2 Container
Instances
K8s API ECS API
AWS Cloud
Auto Scaling group
Managed
Node Groups
Auto Scaling group
Worker
nodes
Auto Scaling groupDIY K8S
NEW
Docker
Host
K8s API
AWSmanagedCustomermanaged