Upload
qiming-teng
View
114
Download
6
Embed Size (px)
Citation preview
1
Exploring Magnum and Senlin integration
for autoscaling containers
Hongbin Lu (Huawei)
Jay Lau, Ton Ngo (IBM)
Qiming Teng, Julio Ruano (IBM)
Exploring Magnum and Senlin integration
Contributors
Exploring Magnum and Senlin integration 2
Zilian Ji, Linjuan Xia, Shijia E, Peiyu Lin, Tianyuan Zhuang, Ji Jiang, Yongkui Wang
Talk Outline
1. Use cases
2. Magnum
3. Senlin
4. How it works
5. Demo
Exploring Magnum and Senlin integration 3
Use cases
Exploring Magnum and Senlin integration 4
Use case
• Shared COE cluster
– Autoscale on some policies (utilization, etc.)
– Scale number of nodes
• Multiple apps on cluster
– Autoscale on some policies (request rate, etc.)
– Scale number of containers
• Example:
– 2, 3-tiered web apps: handle requests
– SLA determines policy
Exploring Magnum and Senlin integration 5
Scaling scenarios (1)
Exploring Magnum and Senlin integration 6
node
c c c
node
c cc
node
c scale app
scale cluster
Single app on cluster
• scale out containers as needed
• scale cluster by utilization
• coordination = utilization
Scaling scenarios (2)
Exploring Magnum and Senlin integration 7
node
c
node
c c
node
c c c c scale 2 apps
Two apps on cluster
• scale out containers as needed
• scale cluster by utilization
• coordination = utilization
scale cluster
unlimited
scale cluster
limited
Scaling scenarios (3)
Exploring Magnum and Senlin integration 8
node
c c
node
scale 2 apps
scale cluster
limited
c
node
c c c c c c
Two apps on cluster, limited cluster size
• blue scales first, retains containers
• red scales later, fails
• maybe acceptable
• what if red is critical and blue is not
• inverted priority: blue < red
Scaling scenarios (4)
Exploring Magnum and Senlin integration 9
node
c c scale 2 apps
Limit on apps
• Place max on blue
• blue scales, red does not scale
• cannot use full resources
scale cluster
limited
c
nodenode
c
limited
Scaling scenarios (5)
Exploring Magnum and Senlin integration 10
node
c c
node
scale 2 apps
scale cluster
limited
c
node
c c c c c cc c c c
Priority on apps
• blue scales first, red scales later
• blue scales back to free up resource for red
• 2 ways linkage: container cluster host cluster
Magnum
Exploring Magnum and Senlin integration 11
Instance
Magnum Overview
Exploring Magnum and Senlin integration 12
• Provision
• Kubernetes
• Docker Swarm
• Mesos
• Scale
• Add instances
• Remove instances
• Manage
• Pod
• Service
• Replication Controller
• Container
Nova Instance
containercontainer
Magnum CLI
Magnum
Heat
Magnum Architecture
Exploring Magnum and Senlin integration 13
Magnum: Autoscale Bay
1. Raw data: Magnum pulls raw
data from Bays.
2. Metrics: Metrics, like memory
utilization, are computed and sent
them to Ceilometer.
3. Alarm: Ceilometer triggers alarms
based on user-specified scenario
and metrics.
4. Scale: Heat scales the bays.
Exploring Magnum and Senlin integration 14
Ceilometer
Magnum Heat
Bay1) Raw data
2) Metrics 3) Alarm
4) Scale
Kubernetes: Autoscale Pod
1. Metrics: The autoscaler
periodically queries pods’ metrics.
2. Scale: Based on collected
metrics, the autoscaler uses a
built-in algorithm to trigger the
scaling.
3. Resize: Replication Controller
resize the pods.
Exploring Magnum and Senlin integration 15
Horizontal
Pod
Autoscaler
Pods
1) Metrics3) Resize
Replication
Controller
2) Scale
Future direction
• Magnum AutoScaler
– A new component in Magnum
• Scaling Bays
• Scaling Applications
– Interacts with AutoScaler from COEs
• Kubernetes AutoScaler as a driver for container-level scaling
• Magnum responsible for scaling RCs without Kubernetes autoscaler
– Customizability
• data sources
• metrics and thresholds
• standby bay nodes (i.e. resource pool)
Exploring Magnum and Senlin integration 16
Two-Levels of AutoScaling
Exploring Magnum and Senlin integration 17
Working
K8S Bay
NodeNode
K8S Master
Heapster
Kublet
cAdvisor
Kublet
cAdvisor
Storage Backend
RC AutoScaler
Pod
Magnum AutoScaler Service
K8S Driver
Collector
Analyzer
OperatorSwarm Driver
MesosDriver
Senlin
Magnum Conductor
Standby
Senlin
Exploring Magnum and Senlin integration 18
Clustering - A Missing Service in OpenStack
Exploring Magnum and Senlin integration 19
Scalable
Load-Balanced
Highly-Available
Manageable
......
of any (OpenStack) objects
Senlin Architecture
Exploring Magnum and Senlin integration 20
REST RPC
Senlin
Database
Policies
Profiles
Clustering/AutoScaling/LoadBalancing
Exploring Magnum and Senlin integration 21
Nova
Kubernetes
Heat
Ironic BareMetal
VMs
Stacks
Containers
Senlin
placement
deletion
scaling
health
load-balance
batching
Scaling A Cluster using Senlin
Exploring Magnum and Senlin integration 22
type: os.nova.serverversion: 1.0properties:
image: fedora-21flavor: 3networks:
- network: privateuserdata:
...
Profile
Cluster
type: senlin.policy.scalingversion: 1.0properties:
event: CLUSTER_SCALE_INadjustment:
type: CHANGE_IN_CAPACITYnumber: 1min_step: 1best_effort: True
attach
Policy
type: senlin.policy.scalingversion: 1.0properties:
event: CLUSTER_SCALE_OUTadjustment:
. . .
attach
Policy
webhook
RESIZE
Policies
Exploring Magnum and Senlin integration 23
type: senlin.policy.scalingversion: 1.0properties:adjustment:min_step: 1
best_effort: true
number: 1type: CHANGE_IN_CAPACITY
event: CLUSTER_SCALE_OUT
• Declarative
• Can be mapped to from a standard
• Example: SUR_Cluster
(Add k8s Minion / Add Spark worker node)
Trigger
Exploring Magnum and Senlin integration 24
type: CeilometerThresholdAlarmversion: 1.0rule:meter_name: memory_utilcomparison_operator: gtthreshold: 70period: 60evaluation_periods: 1statistic: avgquery:- field: resource_metadata.clusterop: eqvalue: SUR_Cluster
• Generic abstraction
• alarms in OpenStack
monitoring services
• e.g. Ceilometer Alarm
How it works
Exploring Magnum and Senlin integration 25
Design goals
1. Coordinate scaling at apps and cluster level
• Control flows in both direction
• Apps -> Cluster: utilization, other methods
• Cluster -> Apps: priority, other methods
2. Integrate scaling support from COE if available
• Kubernetes autoscaler
3. Policy driven
• Easy to express, manage complex cases
Exploring Magnum and Senlin integration 26
template
Outer Stack
Autoscaling: OpenStack-Only Solution (Today)
27 Exploring Magnum and Senlin integration
AutoScalingGroup Stack
Heat
Ceilometer
AH
PUp PDn
AL
ASGS1 S2 S3
updateASG
Senlin
profile
Autoscaling: OpenStack-Only Solution (New)
28 Exploring Magnum and Senlin integration
Cluster
Ceilometer
AH
PUp
PDn
AL
SCALE_IN
SCALE_OUT
Node1 Node2 Node3
webhookspolicies triggers
Demo
Exploring Magnum and Senlin integration 29
Autoscaling with Kubernetes
30 Exploring Magnum and Senlin integration
VMs
K8S Bay
NodeNode
Heapster
Kublet
cAdvisor
Kublet
cAdvisor
Pod
Senlin
Magnum
profile
CeilometerWorkload
policy
Questions
Exploring Magnum and Senlin integration 31
Thank You
Exploring Magnum and Senlin integration 32