使用 Blox 實現容器任務調度與資源編排
-
Upload
amazon-web-services -
Category
Technology
-
view
176 -
download
0
Transcript of 使用 Blox 實現容器任務調度與資源編排
![Page 1: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/1.jpg)
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Dickson Yue
Senior Solutions Architect
使用 Blox 實現容器任務調度與
資源編排
January 12, 2017
![Page 2: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/2.jpg)
What is Amazon ECS?
Scalable Container
Management
Flexible Container
Placement
AWS Platform
IntegrationExtensible by Design
![Page 3: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/3.jpg)
Amazon ECS: Under the Hood
ALB ALB
AZ 1 AZ 2
user / scheduler
Scheduler
Cluster State Service
Placement Engine
Event Stream
![Page 4: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/4.jpg)
Task Placement Engine
![Page 5: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/5.jpg)
New Placement Constraints & Attributes
Name Example
AMI ID attribute:ecs.ami-id == ami-eca289fb
Availability Zone attribute:ecs.availability-zone == us-east-1a
Instance Type attribute:ecs.instance-type == t2.small
Distinct Instances type=“distinctInstance”
Custom attribute:stack == prod
![Page 6: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/6.jpg)
Anatomy of Task Placement
Cluster Constraints
Custom Constraints
Placement Strategies
Apply Filter
Satisfy CPU, memory, and port requirements
Filter for location, instance-type, AMI, or custom
attribute constraints
Identify instances that meet spread or binpack
placement strategy
Select final container instances for placement
![Page 7: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/7.jpg)
Supported Placement Strategies
Binpacking Spread Affinity Distinct Instance
![Page 8: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/8.jpg)
Placement Strategy Chaining
Spread tasks across Zones
and Binpack within each Zone
![Page 9: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/9.jpg)
New Cluster Query Language
![Page 10: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/10.jpg)
Filtering: Match on Instance Family or Type
![Page 11: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/11.jpg)
Filtering: Match on Availability Zone
![Page 12: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/12.jpg)
Filtering: Match on Multiple Expressions
![Page 13: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/13.jpg)
Filtering: Match on Custom Attributes
![Page 14: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/14.jpg)
Task Placement Examples
![Page 15: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/15.jpg)
g2.2xlarge t2.small g2.2xlarge g2.2xlarge
Placement: Targeting Instance Type
![Page 16: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/16.jpg)
g2.2xlarge t2.small t2.micro t2.medium
t2.medium t2.small g2.2xlarge
t2.small
t2.small t2.medium
us-east-1aus-east-1d
Placement: Targeting Instance Type & Zone
![Page 17: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/17.jpg)
g2.2xlarge t2.small t2.micro t2.medium
t2.medium t2.small g2.2xlarge t2.small
us-east-1aus-east-1d
g2.2xlarge t2.medium
t2.micro t2.small
us-east-1c
Placement: Availability Zone Spread
![Page 18: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/18.jpg)
g2.2xlarge t2.small t2.micro t2.medium
t2.medium t2.small g2.2xlarge t2.small
us-east-1aus-east-1d
g2.2xlarge t2.medium
t2.micro t2.small
us-east-1c
Placement: Spread across Zone and Binpack
![Page 19: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/19.jpg)
g2.2xlarge t2.small t2.micro t2.medium
t2.medium t2.small g2.2xlarge t2.small
us-east-1aus-east-1d
g2.2xlarge t2.medium
t2.micro t2.small
us-east-1c
Placement: Affinity and Anti-Affinity
![Page 20: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/20.jpg)
Running a Service
![Page 21: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/21.jpg)
t2.medium t2.small t2.small
us-east-1aus-east-1d
t2.medium t2.micro t2.small
us-east-1c
Placement: Multiple Services on a Cluster
![Page 22: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/22.jpg)
t2.medium g2.2xlarge t2.micro t2.small
t2.small t2.small g2.2xlarge t2.small
t2.small t2.small
g2.2xlarge t2.small
Placement: Services – Distinct Instances
![Page 23: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/23.jpg)
Console: Getting Started with Placement
![Page 24: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/24.jpg)
Console: Placement Templates to Get Started
![Page 25: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/25.jpg)
Console: Customizing Placement Strategies
![Page 26: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/26.jpg)
Live Demo
![Page 27: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/27.jpg)
Event Stream
![Page 28: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/28.jpg)
Consuming Real-time Events
![Page 29: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/29.jpg)
Three Steps to Getting Started with Events
Step 1: Create CWE Rule Step 2: Create SNS Topic Step 3: Put Events to SNS
![Page 30: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/30.jpg)
Consuming Events for Service Discovery
app1-tst 10.1.0.11
db1-tst 10.1.0.14
app2 10.1.0.16
db2 10.1.0.18
my-app 10.1.0.20
websrv1 10.1.0.1
websrv2 10.1.0.2
websrv3 10.1.0.4
app-dev1 10.1.0.9
app-dev2 10.1.0.5
app-dev3 10.1.0.8
db-dev 10.1.0.19
![Page 31: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/31.jpg)
Introducing Blox
![Page 32: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/32.jpg)
What is Blox?
Choice
Control
Developer Experience
![Page 33: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/33.jpg)
Building with Blox
scheduler cluster state service
![Page 34: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/34.jpg)
Set Up Blox Locally
Step 1: git clone https://github.com/blox/blox.git
Step 3: docker-compose up -d
Step 4: start using Blox locally
Step 2: deploy CloudFormation template to configure ECS event stream and SQS queue
![Page 35: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/35.jpg)
Swagger Spec: Cluster State Service
![Page 36: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/36.jpg)
Swagger Spec: Daemon Scheduler
![Page 37: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/37.jpg)
Daemon Scheduler
![Page 38: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/38.jpg)
t2.small t2.small t2.small
Blox: Daemon Scheduler
t2.small t2.small t2.small
scheduler cluster state service
t2.small t2.small t2.small
![Page 39: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/39.jpg)
Step 1: Create an Environment
![Page 40: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/40.jpg)
Step 2: Create a Deployment
![Page 41: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/41.jpg)
Step 3: Add Container Instances
![Page 42: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/42.jpg)
Step 4: Monitoring and Scaling a Cluster
![Page 43: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/43.jpg)
Live Demo
![Page 44: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/44.jpg)
The Blox Vision
![Page 45: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/45.jpg)
Contributing to Blox
• Blox is licensed under Apache 2.0
• Open an issue or pull request
• Watch our roadmap on GitHub
• Check out our Gitter channel
![Page 46: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/46.jpg)
Summary
![Page 47: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/47.jpg)
Summary
![Page 48: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/48.jpg)
Thank you!
![Page 49: 使用 Blox 實現容器任務調度與資源編排](https://reader030.fdocuments.net/reader030/viewer/2022021417/587fd3051a28ab58248b50c1/html5/thumbnails/49.jpg)
Remember to complete
your evaluations!