初探 AWS 平台上的 Docker 服務

Post on 22-Jan-2018

612 views 3 download

transcript

© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Jowana JO

Technical Account manager, AWS Enterprise Support

June 7th, 2017

Getting Started with Docker on AWS

Agenda

Why Containers?

Cluster Management

Benefits

Running Services

Demo

Why Containers?

What are Containers?

OS virtualization

Process isolation

Images

Automation Server

Guest OS

Bins/Libs Bins/Libs

App2App1

Container advantages

Portable

Flexible

Fast

EfficientServer

Guest OS

Bins/Libs Bins/Libs

App2App1

Services evolve to microservices

Monolithic Application

Order UI User UI Shipping UI

Order

ServiceUser

Service

Shipping

Service

Data

Access

OrderUI

Inventory

Service

Order

Service

Shipping

Service

Containers are natural for microservices

Simple to model

Any app, any language

Image is the version

Test & deploy same artifact

Stateless servers decrease change risk

Server

Guest OS

Bins/Libs Bins/Libs

App2App1

Scheduling one resource is straightforward

Going from this…

Scheduling a cluster is hard

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

Server

Guest OS

.. to this - is hard!

Amazon ECS

Amazon EC2 Container Service (ECS) is a highly

scalable, high performance container management

service that supports Docker containers and allows you

to easily run applications on a managed cluster of

Amazon EC2 instances.

Amazon ECS

EC2 INSTANCES

LOAD

BALANCER

InternetECS

AGENT

TASK

Container

TASK

Container

ECS AGENT

TASK

Container

TASK

ContainerAgent Communication Service

Amazon ECS

ECS AGENT

TASK

Container

TASK

Container

LOAD

BALANCER

API

Cluster Management Engine

Key / Value Store

Amazon ECS - Cluster

EC2 INSTANCES

LOAD

BALANCER

InternetECS

AGENT

TASK

Container

TASK

Container

ECS AGENT

TASK

Container

TASK

Container

ECS AGENT

TASK

Container

TASK

Container

LOAD

BALANCER

Agent Communication Service

Amazon ECS

API

Cluster Management Engine

Key / Value Store

Amazon ECS - Task

EC2 INSTANCES

LOAD

BALANCER

InternetECS

AGENT

TASK

Container

TASK

Container

ECS AGENT

TASK

Container

TASK

Container

ECS AGENT

TASK

Container

TASK

Container

LOAD

BALANCER

Agent Communication Service

Amazon ECS

API

Cluster Management Engine

Key / Value Store

Amazon ECS - Service

EC2 INSTANCES

LOAD

BALANCER

InternetECS

AGENT

TASK

Container

TASK

Container

ECS AGENT

TASK

Container

TASK

Container

ECS AGENT

TASK

Container

TASK

Container

LOAD

BALANCER

Agent Communication Service

Amazon ECS

API

Cluster Management Engine

Key / Value Store

Amazon ECS - Resource Management

EC2 INSTANCES

LOAD

BALANCER

InternetECS

AGENT

TASK

Container

TASK

Container

ECS AGENT

TASK

Container

TASK

ContainerAgent Communication Service

Amazon ECS

ECS AGENT

TASK

Container

TASK

Container

LOAD

BALANCER

API

Cluster Management Engine

Key / Value Store

Amazon ECS - Agent Communication

EC2 INSTANCES

LOAD

BALANCER

InternetECS

AGENT

TASK

Container

TASK

Container

ECS AGENT

TASK

Container

TASK

ContainerAgent Communication Service

Amazon ECS

ECS AGENT

TASK

Container

TASK

Container

LOAD

BALANCER

API

Cluster Management Engine

Key / Value Store

Amazon ECS - Key / Value Store

EC2 INSTANCES

LOAD

BALANCER

InternetECS

AGENT

TASK

Container

TASK

Container

ECS AGENT

TASK

Container

TASK

ContainerAgent Communication Service

Amazon ECS

ECS AGENT

TASK

Container

TASK

Container

LOAD

BALANCER

API

Cluster Management Engine

Key / Value Store

Amazon ECS - API

EC2 INSTANCES

LOAD

BALANCER

InternetECS

AGENT

TASK

Container

TASK

Container

ECS AGENT

TASK

Container

TASK

ContainerAgent Communication Service

Amazon ECS

ECS AGENT

TASK

Container

TASK

Container

LOAD

BALANCER

API

Cluster Management Engine

Key / Value Store

Amazon ECS: Scheduling

Amazon ECS: Scheduling

Amazon ECS: Scheduling

Amazon ECS: Scheduling

Benefits

Amazon ECS benefits

• Fully managed elastic service – You don’t

need to run anything, and the service scales as

your microservices architecture grows

• Shared state optimistic scheduling

• Deep Integration With Other AWS Services

• Application Load Balancing

• Amazon Elastic Block Store

• Amazon Virtual Private Cloud

• Amazon CloudWatch

• AWS Identify and Access Management

• AWS CloudTrail

Running services

Task Definitions

Volume Definitions

Container Definitions

Key Components: Task Definitions

Key Components: Task Definitions

Tasks

Shared Data

Volume

Containers

schedule

Container

Instance

Volume Definitions

Container Definitions

Unit of work

Grouping of related Containers

Run on Container Instances

Tasks

Create a Service

Good for long-running

applications and services

Create Service

Load Balance traffic across containers

Automatically recover unhealthy containers

Discover services

Elastic Load Balancing

Shared Data Volume

Containers

Shared Data Volume

Containers

Shared Data Volume

Containers

Scale Service

Scale up

Scale down

Elastic Load Balancing

Shared Data Volume

Containers

Shared Data Volume

Containers

Shared Data Volume

Containers

Shared Data Volume

Containers

Update Service

Deploy new version

Drain connections

new new new

Elastic Load Balancing

Shared Data

Volume

Containers

old old old

Shared Data

Volume

Containers

Shared Data

Volume

Containers

Shared Data

Volume

Containers

Shared Data

Volume

Containers

Shared Data

Volume

Containers

Update Service (cont.)

Deploy new version

Drain connections

new new new

Elastic Load Balancing

Shared Data

Volume

Containers

old old old

Shared Data

Volume

Containers

Shared Data

Volume

Containers

Shared Data

Volume

Containers

Shared Data

Volume

Containers

Shared Data

Volume

Containers

Update Service (cont.)

Deploy new version

Drain connections

Elastic Load Balancing

Shared Data Volume

Containers

Shared Data Volume

Containers

Shared Data Volume

Containers

new new new

Update Service (cont.)

Specify a deployment configuration for your service:

• minimumHealthyPercent: lower limit (as a percentage of

the service's desiredCount) of the number of running

tasks that must remain running in a service during a

deployment.

• maximumPercent: upper limit (as a percentage of the

service's desiredCount) of the number of running tasks

that can be running in a service during a deployment.

Update Service (cont.)

Deploy using the least space: minimumHealthyPercent =

50%, maximumPercent = 100%

Update Service (cont.)

Deploy quickly without reducing service capacity:

minimumHealthyPercent = 100%, maximumPercent =

200%

Demo

Thank You!