SlideShare a Scribd company logo
Artem Zhurbila
artemzhurbilo@gmail.com
Solit2015#5
Agenda
1. Base concepts of cluster
management and docker
2. Docker Swarm
3. Amazon EC2 Container Service
4. Kubernetes
5. Mesosphere
2
3
4
5
6
Docker is awesome on a single host, but ....
● Single point of failure
■ high availability
● Limited resources (CPU, RAM)
■ scalability
7
Cluster
Multiple nodes viewed as a
single system.
Docker cluster components
● Resource and node container manager
● Scheduler
● Service discovery (consul, etcd, zookeeper, DNS + srv)
● Overlay network (flannel, weave, socketplane)
8
Docker cluster management tools
1. Docker Swarm
2. Amazon EC2 Container Service (ECS)
3. Kubernetes (k8s)
4. Mesosphere
9
Docker Swarm
Docker-native clustering
system
10
11
12
Swarm / scheduling strategies
1. BinPacking - CPU and
RAM available and will
return the node the most
packed already
2. Random
13
Swarm / scheduling filters
14
1. Constraint
a. key/value - support glob and regexp
b. dockerinfo
2. Affinity
a. containers
b. images
3. Dependency
a. Shared volumes (--volumes-from)
b. Links (--link)
c. Shared network stack (--net)
4. Port
5. Health
Swarm / service discovery
Providers:
1. token (docker hub service)
2. file
3. etcd
4. consul
5. zookeeper
15
Setup Swarm cluster manually
1 step: install >= 1.4.0 docker
2 step: change /etc/default/docker file to listen tcp
DOCKER_OPTS="-H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock"
3 step: create certificates and configure TLS (optional)
4 step: docker pull swarm
5 step: docker run --rm swarm create
generate unique cluster_id for using docker hub discovery service
6 step: docker run -d swarm join --addr=<node_ip:2375> token://<cluster_id>
run this command on all hosts
7 step: docker run -d -p <swarm_port>:2375 swarm manage token://<cluster_id>
start the Swarm Master
8 step: export DOCKER_HOST=tcp://<swarm_ip>:<swarm_port>
9 step: use your usual docker commands :-)
16
#1 Setup cluster on AWS by Docker Machine
1 step: download Docker-machine and add it to PATH
https://docs.docker.com/machine/#installation
2 step: run command to create Swarm Master
docker-machine create -d amazonec2 --swarm --swarm-master 
--swarm-discovery=token://<generated_cluster_id> 
--amazonec2-access-key=***** 
--amazonec2-ami=ami-823686f5 
--amazonec2-instance-type=t2.micro 
--amazonec2-region=eu-west-1 
--amazonec2-root-size=10 
--amazonec2-secret-key=***** 
--amazonec2-security-group=my 
--amazonec2-vpc-id=default 
swarm-master
17
#2 Setup cluster on AWS by Docker Machine
3 step: run command (like in step 2 but without --swarm-
master key) to create Swarm Slave
docker-machine create -d amazonec2 --swarm 
--swarm-discovery=token://<generated_cluster_id> 
….
swarm-slave-01
4 step: export DOCKER_HOST=tcp://<swarm_ip>:<swarm_port>
5 step: use your usual docker commands or Docker-
compose :-)
18
Swarm / conclusion
+ standard Docker API
+ extremely easy to get started
- many features are not implemented “yet”
(multi-master, multi-host network, failover)
DOCKER MACHINE + SWARM + COMPOSE
=
19
Amazon EC2 Container Service (preview)
ECS is available in the US East (N. Virginia) and the US
West (Oregon) region during the preview.
20
ECS key concepts
Cluster - a logical grouping of container instances
Container Instance - EC2 instance that is running the ECS
agent and has been registered into a cluster.
Task Definition - a description of an application (json) - lists
of containers grouped together.
Task - task definition that is running on a container instance.
21
#1 Setup ECS cluster
step 1: create IAM role that allows
EC2 use ECS service.
step 2: install awscli > 1.7
step 3: change region in ~/.
aws/config
[default]
output = json
region = us-east-1
22
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ecs:CreateCluster",
"ecs:RegisterContainerInstance",
"ecs:
DeregisterContainerInstance",
"ecs:DiscoverPollEndpoint",
"ecs:Submit*",
"ecs:Poll"
],
"Resource": [
"*"
]
}
]
}
#2 Setup ECS cluster
step 3: run command to create cluster (Your account is
limited to 2 clusters):
aws ecs create-cluster --cluster-name MyCluster
step 4: create user data script init_script.sh
#!/bin/bash
echo ECS_CLUSTER=MyCluster >> /etc/ecs/ecs.config
step 5: create 3 EC2 instances in cluster
aws ec2 run-instances --image-id ami-801544e8 --count 3 --instance-type t2.
micro --key-name <public_key> --security-groups <sec_group> --user-data
file://init_script.sh --iam-instance-profile Name=<IAM role name>
23
24
#3 Setup ECS cluster
step 6: Create task definition:
- nginx_def.json
step 7: register definition:
aws ecs register-task-definition --cli-
input-json file://nginx_def.json
step 8: run a task:
aws ecs run-task --cluster MyCluster --
task-definition test_nginx
25
{
"containerDefinitions": [
{
"name": "nginx",
"image": "nginx",
"cpu": 200,
"memory": 100,
"portMappings": [
{
"containerPort": 80,
"hostPort": 80
}
],
"essential": true
}
],
"family": "test_nginx"
}
If we stop this EC2 instance, task with nginx container will
be resheduled (failover) to another hosts in cluster!
26
EC2 Container Service / conclusion
+ Use ECS we don’t need to administrate Master nodes. High
availability of ECS is responsibility of AWS engineers.
- I have not found how to integrate with ELB, Autoscale and other
Amazon services (may be it’s under development now)
27
Kubernetes (k8s)
28
Kubernetes (k8s) key concepts
Node - worker machine in Kubernetes (previously known as
Minion)
Pod - the smallest unit - colocated group of Docker containers.
Label - key-value tag
Replication controller - ensures that a specified number of pod
"replicas" are running at any one time
Service - provide a single, stable name and address for a set of
pods. They act as basic load balancers.
29
30
Kubernetes / monitoring - Heapster
Heapster enables monitoring of clusters using cAdvisor.
31
#1 Kubernetes / Setup on AWS
step 1: install aws cli and k8s
step 2: check your aws creds in ~/.
aws/credentials
step 3: add env vars:
export PATH=$PATH:
<path_to_untar_k8s_directory>/platforms/<os>/<platform>
export PATH=$PATH:<path_to_untar_k8s_directory>/cluster
export KUBERNETES_PROVIDER=aws
step 4: create ‘kubernetes’ IAM role with
EC2FullAccess
32
#2 Kubernetes / Setup on AWS
step 5: up the cluster (it takes about 5 minutes) kube-up.sh
- script will provision a new VPC, 1 master and 4 node (minions) in us-west-2 (Oregon).
- create a keypair called "kubernetes" as well as reuse an IAM role also called "kubernetes"
- create S3 bucket ‘kubernetes-staging-***’ and upload Salt provision scripts
- create CAFile, CertFile, KeyFile on your local computer
At the end of the script execution you see the URL of k8s master
33
#3 Kubernetes / Setup on AWS
step 6: export KUBERNETES_MASTER=https://<generated_url_from_step_5>
Now cluster is ready and we can manipulate this one by kubectl
Then you can see examples of replication controllers and services in
kubernetes git repo
https://github.com/GoogleCloudPlatform/kubernetes/tree/master/examples
34
Kubernetes / conclusion
In my opinion Kubernetes is the most progressive and
feature-rich cluster management tool nowadays.
+ pluggable architecture (in future you can easily replace
docker by other container engine)
+ self-healing (auto-restart, auto-replication)
+ Google Container Engine (Alpha) powered by
Kubernetes
+ support integration with a lot of Cloud providers
+ declarative templates of all resources (json or yaml)
35
Kubernetes
36
Promo Code: TRY-KUBERNETES
Mesosphere Data Center OS
37
DCOS public launch in the first half of 2015
Mesos + Docker
38
Conteinerizer API since 0.18.0 in Mesos
Docker is supported since 0.20.0
Mesosphere layers
39
3. Your Apps
2. Datacenter Services
YARN / Kubernetes / Marathon /
Chronos / Aurora / Spark / Kafka
1. Mesosphere DCOS
Mesos as OS kernel
Mesos Frameworks
40
How mesos works
41
42
digitalocean.mesosphere.com
43
digitalocean.mesosphere.com
1: Download vpn configuration file
2: Create security tunnel
sudo openvpn <path_to_downloaded_conf_file>
3: Now you can communicate with cluster services
44
Docker app json example
{
"container": {
"type": "DOCKER",
"docker": {
"image": "libmesos/ubuntu"
}
},
"id": "ubuntu",
"instances": 1,
"cpus": 0.5,
"mem": 512,
"cmd": "while sleep 10; do date -u +%T; done"
}
45
curl -X POST -H "Content-Type: application/json" http://<mesos_internal_master_ip>:8080/v2/apps -
d@<path_to_json_file>
Mesosphere / conclusion
Mesosphere DCOS is future of the data
centers !
Already now it is able to gather
all the zoo of technologies.
46
Artem Zhurbila
artemzhurbilo@gmail.com
https://www.linkedin.com/in/zhurbila
47

More Related Content

PDF
Kubernetes Boston — Custom High Availability of Kubernetes
PDF
Amazon EC2 Container Service in Action
PDF
Vagrant for real (codemotion rome 2016)
PDF
Docker Swarm 0.2.0
PPTX
Docker toolbox
PPTX
How to create a secured cloudera cluster
PDF
Kubernetes internals (Kubernetes 해부하기)
PPTX
Docker Swarm for Beginner
Kubernetes Boston — Custom High Availability of Kubernetes
Amazon EC2 Container Service in Action
Vagrant for real (codemotion rome 2016)
Docker Swarm 0.2.0
Docker toolbox
How to create a secured cloudera cluster
Kubernetes internals (Kubernetes 해부하기)
Docker Swarm for Beginner

What's hot (20)

PDF
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
PDF
Continuous Delivery: The Next Frontier
PDF
The age of orchestration: from Docker basics to cluster management
PDF
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
PPTX
How to create a multi tenancy for an interactive data analysis with jupyter h...
PDF
From Monolith to Docker Distributed Applications
PDF
Kubernetes installation
PDF
Docker up and running
PDF
Kubernetes 1.3 - Highlights
PDF
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
PDF
Ansible not only for Dummies
PDF
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
PDF
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
PPT
Learn basic ansible using docker
PPTX
Introduction to docker swarm
PDF
Enhancing OpenShift Security for Business Critical Deployments
PPTX
Vagrant, Ansible, and OpenStack on your laptop
PDF
From Dev to DevOps - Codemotion ES 2012
PPTX
Docker Swarm Introduction
PDF
Multinode kubernetes-cluster
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
Continuous Delivery: The Next Frontier
The age of orchestration: from Docker basics to cluster management
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
How to create a multi tenancy for an interactive data analysis with jupyter h...
From Monolith to Docker Distributed Applications
Kubernetes installation
Docker up and running
Kubernetes 1.3 - Highlights
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
Ansible not only for Dummies
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
Learn basic ansible using docker
Introduction to docker swarm
Enhancing OpenShift Security for Business Critical Deployments
Vagrant, Ansible, and OpenStack on your laptop
From Dev to DevOps - Codemotion ES 2012
Docker Swarm Introduction
Multinode kubernetes-cluster
Ad

Viewers also liked (20)

PDF
OpenStack Summit - Tokio
PPTX
Salesforce1 Platform
PDF
Kubernetes Basics & Monitoring
PDF
Red Hat Forum Tokyo - OpenStack Architecture
PDF
Kubernetes intro public - kubernetes user group 4-21-2015
PDF
Docker Swarm 1.12 Overview and Demo
PDF
Docker 1.12 (dockercon recap)
PDF
Scale into Multi-Cloud with Containers
PDF
Forecast 2014: TOSCA: An Open Standard for Business Application Agility and P...
PPTX
Keystone - Openstack Identity Service
PPTX
Building IAM for OpenStack
PDF
Microservices Architectures with Docker Swarm, etcd, Kuryr and Neutron
PPTX
A brief study on Kubernetes and its components
PDF
Moving from Monolith to Microservices
PDF
OpenStack keystone identity service
PDF
Revolutionizing WSO2 PaaS with Kubernetes & App Factory
PPTX
GMOインターネット様 発表「OpenStackのモデルの最適化とConoHa, Z.comとGMOアプリクラウドへの適用」 - OpenStack最新情...
PDF
Lesson Learned from Using Docker Swarm at Pronto
PPTX
Docker Networking (Libnetwork) - Lakshman Kumar
PPTX
Docker Networking & Swarm Mode Introduction
OpenStack Summit - Tokio
Salesforce1 Platform
Kubernetes Basics & Monitoring
Red Hat Forum Tokyo - OpenStack Architecture
Kubernetes intro public - kubernetes user group 4-21-2015
Docker Swarm 1.12 Overview and Demo
Docker 1.12 (dockercon recap)
Scale into Multi-Cloud with Containers
Forecast 2014: TOSCA: An Open Standard for Business Application Agility and P...
Keystone - Openstack Identity Service
Building IAM for OpenStack
Microservices Architectures with Docker Swarm, etcd, Kuryr and Neutron
A brief study on Kubernetes and its components
Moving from Monolith to Microservices
OpenStack keystone identity service
Revolutionizing WSO2 PaaS with Kubernetes & App Factory
GMOインターネット様 発表「OpenStackのモデルの最適化とConoHa, Z.comとGMOアプリクラウドへの適用」 - OpenStack最新情...
Lesson Learned from Using Docker Swarm at Pronto
Docker Networking (Libnetwork) - Lakshman Kumar
Docker Networking & Swarm Mode Introduction
Ad

Similar to Artem Zhurbila - docker clusters (solit 2015) (20)

PDF
게임 고객사를 위한 ‘AWS 컨테이너 교육’ 자료 - 유재석 솔루션즈 아키텍트, AWS :: Gaming Immersion Day 201...
PPTX
Getting Started With Docker on AWS
PDF
Running Docker Containers on AWS
PDF
Come costruire una Platform As A Service con Docker, Kubernetes Go e Java
PDF
Dessi docker kubernetes paas cloud
PDF
Deliver Docker Containers Continuously on AWS - QCon 2017
PDF
Clusternaut: Orchestrating Percona XtraDB Cluster with Kubernetes.
PDF
ECS & ECR Deep Dive - 김기완 솔루션즈 아키텍트 :: AWS Container Day
PDF
Elastic Kubernetes Services (EKS)
PDF
Amazon ECS (March 2016)
PDF
Docker clusters on AWS with Amazon ECS and Kubernetes
PPTX
Container Orchestration with Docker Swarm and Kubernetes
PDF
ECS and ECR deep dive
PDF
Clusternaut: Orchestrating  Percona XtraDB Cluster with Kubernetes
PDF
[AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
PDF
Swarm: Native Docker Clustering
PPTX
Intro to cluster scheduler for Linux containers
PPTX
AWS ECS Meetup Talentica
PDF
Kubernetes2
PDF
Kubernetes and Amazon ECS
게임 고객사를 위한 ‘AWS 컨테이너 교육’ 자료 - 유재석 솔루션즈 아키텍트, AWS :: Gaming Immersion Day 201...
Getting Started With Docker on AWS
Running Docker Containers on AWS
Come costruire una Platform As A Service con Docker, Kubernetes Go e Java
Dessi docker kubernetes paas cloud
Deliver Docker Containers Continuously on AWS - QCon 2017
Clusternaut: Orchestrating Percona XtraDB Cluster with Kubernetes.
ECS & ECR Deep Dive - 김기완 솔루션즈 아키텍트 :: AWS Container Day
Elastic Kubernetes Services (EKS)
Amazon ECS (March 2016)
Docker clusters on AWS with Amazon ECS and Kubernetes
Container Orchestration with Docker Swarm and Kubernetes
ECS and ECR deep dive
Clusternaut: Orchestrating  Percona XtraDB Cluster with Kubernetes
[AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
Swarm: Native Docker Clustering
Intro to cluster scheduler for Linux containers
AWS ECS Meetup Talentica
Kubernetes2
Kubernetes and Amazon ECS

More from Artem Zhurbila (7)

PDF
Artem zhurbila the story of rebuilding puppet (devops meetup 29.10.2015)
PDF
Artem Zhurbila 5 aws - cloud formation and beanstalk
PDF
Artem Zhurbila 4 aws - s3, glacier, cloud front, rds
PDF
Artem Zhurbila - 3 aws - route 53, vpc
PDF
Artem Zhurbila - 2 aws - EC2
PDF
Artem Zhurbila - 1 aws overview
PDF
Artem Zhurbila - Some ways to set up the server (highload strategy meetup lig...
Artem zhurbila the story of rebuilding puppet (devops meetup 29.10.2015)
Artem Zhurbila 5 aws - cloud formation and beanstalk
Artem Zhurbila 4 aws - s3, glacier, cloud front, rds
Artem Zhurbila - 3 aws - route 53, vpc
Artem Zhurbila - 2 aws - EC2
Artem Zhurbila - 1 aws overview
Artem Zhurbila - Some ways to set up the server (highload strategy meetup lig...

Recently uploaded (20)

PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Encapsulation theory and applications.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Empathic Computing: Creating Shared Understanding
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Big Data Technologies - Introduction.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
A Presentation on Artificial Intelligence
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Advanced methodologies resolving dimensionality complications for autism neur...
Encapsulation theory and applications.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Encapsulation_ Review paper, used for researhc scholars
Empathic Computing: Creating Shared Understanding
Reach Out and Touch Someone: Haptics and Empathic Computing
Per capita expenditure prediction using model stacking based on satellite ima...
“AI and Expert System Decision Support & Business Intelligence Systems”
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Spectral efficient network and resource selection model in 5G networks
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Review of recent advances in non-invasive hemoglobin estimation
Big Data Technologies - Introduction.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Unlocking AI with Model Context Protocol (MCP)
A Presentation on Artificial Intelligence
Mobile App Security Testing_ A Comprehensive Guide.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx

Artem Zhurbila - docker clusters (solit 2015)

  • 2. Agenda 1. Base concepts of cluster management and docker 2. Docker Swarm 3. Amazon EC2 Container Service 4. Kubernetes 5. Mesosphere 2
  • 3. 3
  • 4. 4
  • 5. 5
  • 6. 6 Docker is awesome on a single host, but .... ● Single point of failure ■ high availability ● Limited resources (CPU, RAM) ■ scalability
  • 7. 7 Cluster Multiple nodes viewed as a single system.
  • 8. Docker cluster components ● Resource and node container manager ● Scheduler ● Service discovery (consul, etcd, zookeeper, DNS + srv) ● Overlay network (flannel, weave, socketplane) 8
  • 9. Docker cluster management tools 1. Docker Swarm 2. Amazon EC2 Container Service (ECS) 3. Kubernetes (k8s) 4. Mesosphere 9
  • 11. 11
  • 12. 12
  • 13. Swarm / scheduling strategies 1. BinPacking - CPU and RAM available and will return the node the most packed already 2. Random 13
  • 14. Swarm / scheduling filters 14 1. Constraint a. key/value - support glob and regexp b. dockerinfo 2. Affinity a. containers b. images 3. Dependency a. Shared volumes (--volumes-from) b. Links (--link) c. Shared network stack (--net) 4. Port 5. Health
  • 15. Swarm / service discovery Providers: 1. token (docker hub service) 2. file 3. etcd 4. consul 5. zookeeper 15
  • 16. Setup Swarm cluster manually 1 step: install >= 1.4.0 docker 2 step: change /etc/default/docker file to listen tcp DOCKER_OPTS="-H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock" 3 step: create certificates and configure TLS (optional) 4 step: docker pull swarm 5 step: docker run --rm swarm create generate unique cluster_id for using docker hub discovery service 6 step: docker run -d swarm join --addr=<node_ip:2375> token://<cluster_id> run this command on all hosts 7 step: docker run -d -p <swarm_port>:2375 swarm manage token://<cluster_id> start the Swarm Master 8 step: export DOCKER_HOST=tcp://<swarm_ip>:<swarm_port> 9 step: use your usual docker commands :-) 16
  • 17. #1 Setup cluster on AWS by Docker Machine 1 step: download Docker-machine and add it to PATH https://docs.docker.com/machine/#installation 2 step: run command to create Swarm Master docker-machine create -d amazonec2 --swarm --swarm-master --swarm-discovery=token://<generated_cluster_id> --amazonec2-access-key=***** --amazonec2-ami=ami-823686f5 --amazonec2-instance-type=t2.micro --amazonec2-region=eu-west-1 --amazonec2-root-size=10 --amazonec2-secret-key=***** --amazonec2-security-group=my --amazonec2-vpc-id=default swarm-master 17
  • 18. #2 Setup cluster on AWS by Docker Machine 3 step: run command (like in step 2 but without --swarm- master key) to create Swarm Slave docker-machine create -d amazonec2 --swarm --swarm-discovery=token://<generated_cluster_id> …. swarm-slave-01 4 step: export DOCKER_HOST=tcp://<swarm_ip>:<swarm_port> 5 step: use your usual docker commands or Docker- compose :-) 18
  • 19. Swarm / conclusion + standard Docker API + extremely easy to get started - many features are not implemented “yet” (multi-master, multi-host network, failover) DOCKER MACHINE + SWARM + COMPOSE = 19
  • 20. Amazon EC2 Container Service (preview) ECS is available in the US East (N. Virginia) and the US West (Oregon) region during the preview. 20
  • 21. ECS key concepts Cluster - a logical grouping of container instances Container Instance - EC2 instance that is running the ECS agent and has been registered into a cluster. Task Definition - a description of an application (json) - lists of containers grouped together. Task - task definition that is running on a container instance. 21
  • 22. #1 Setup ECS cluster step 1: create IAM role that allows EC2 use ECS service. step 2: install awscli > 1.7 step 3: change region in ~/. aws/config [default] output = json region = us-east-1 22 { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ecs:CreateCluster", "ecs:RegisterContainerInstance", "ecs: DeregisterContainerInstance", "ecs:DiscoverPollEndpoint", "ecs:Submit*", "ecs:Poll" ], "Resource": [ "*" ] } ] }
  • 23. #2 Setup ECS cluster step 3: run command to create cluster (Your account is limited to 2 clusters): aws ecs create-cluster --cluster-name MyCluster step 4: create user data script init_script.sh #!/bin/bash echo ECS_CLUSTER=MyCluster >> /etc/ecs/ecs.config step 5: create 3 EC2 instances in cluster aws ec2 run-instances --image-id ami-801544e8 --count 3 --instance-type t2. micro --key-name <public_key> --security-groups <sec_group> --user-data file://init_script.sh --iam-instance-profile Name=<IAM role name> 23
  • 24. 24
  • 25. #3 Setup ECS cluster step 6: Create task definition: - nginx_def.json step 7: register definition: aws ecs register-task-definition --cli- input-json file://nginx_def.json step 8: run a task: aws ecs run-task --cluster MyCluster -- task-definition test_nginx 25 { "containerDefinitions": [ { "name": "nginx", "image": "nginx", "cpu": 200, "memory": 100, "portMappings": [ { "containerPort": 80, "hostPort": 80 } ], "essential": true } ], "family": "test_nginx" }
  • 26. If we stop this EC2 instance, task with nginx container will be resheduled (failover) to another hosts in cluster! 26
  • 27. EC2 Container Service / conclusion + Use ECS we don’t need to administrate Master nodes. High availability of ECS is responsibility of AWS engineers. - I have not found how to integrate with ELB, Autoscale and other Amazon services (may be it’s under development now) 27
  • 29. Kubernetes (k8s) key concepts Node - worker machine in Kubernetes (previously known as Minion) Pod - the smallest unit - colocated group of Docker containers. Label - key-value tag Replication controller - ensures that a specified number of pod "replicas" are running at any one time Service - provide a single, stable name and address for a set of pods. They act as basic load balancers. 29
  • 30. 30
  • 31. Kubernetes / monitoring - Heapster Heapster enables monitoring of clusters using cAdvisor. 31
  • 32. #1 Kubernetes / Setup on AWS step 1: install aws cli and k8s step 2: check your aws creds in ~/. aws/credentials step 3: add env vars: export PATH=$PATH: <path_to_untar_k8s_directory>/platforms/<os>/<platform> export PATH=$PATH:<path_to_untar_k8s_directory>/cluster export KUBERNETES_PROVIDER=aws step 4: create ‘kubernetes’ IAM role with EC2FullAccess 32
  • 33. #2 Kubernetes / Setup on AWS step 5: up the cluster (it takes about 5 minutes) kube-up.sh - script will provision a new VPC, 1 master and 4 node (minions) in us-west-2 (Oregon). - create a keypair called "kubernetes" as well as reuse an IAM role also called "kubernetes" - create S3 bucket ‘kubernetes-staging-***’ and upload Salt provision scripts - create CAFile, CertFile, KeyFile on your local computer At the end of the script execution you see the URL of k8s master 33
  • 34. #3 Kubernetes / Setup on AWS step 6: export KUBERNETES_MASTER=https://<generated_url_from_step_5> Now cluster is ready and we can manipulate this one by kubectl Then you can see examples of replication controllers and services in kubernetes git repo https://github.com/GoogleCloudPlatform/kubernetes/tree/master/examples 34
  • 35. Kubernetes / conclusion In my opinion Kubernetes is the most progressive and feature-rich cluster management tool nowadays. + pluggable architecture (in future you can easily replace docker by other container engine) + self-healing (auto-restart, auto-replication) + Google Container Engine (Alpha) powered by Kubernetes + support integration with a lot of Cloud providers + declarative templates of all resources (json or yaml) 35
  • 37. Mesosphere Data Center OS 37 DCOS public launch in the first half of 2015
  • 38. Mesos + Docker 38 Conteinerizer API since 0.18.0 in Mesos Docker is supported since 0.20.0
  • 39. Mesosphere layers 39 3. Your Apps 2. Datacenter Services YARN / Kubernetes / Marathon / Chronos / Aurora / Spark / Kafka 1. Mesosphere DCOS Mesos as OS kernel
  • 42. 42
  • 44. digitalocean.mesosphere.com 1: Download vpn configuration file 2: Create security tunnel sudo openvpn <path_to_downloaded_conf_file> 3: Now you can communicate with cluster services 44
  • 45. Docker app json example { "container": { "type": "DOCKER", "docker": { "image": "libmesos/ubuntu" } }, "id": "ubuntu", "instances": 1, "cpus": 0.5, "mem": 512, "cmd": "while sleep 10; do date -u +%T; done" } 45 curl -X POST -H "Content-Type: application/json" http://<mesos_internal_master_ip>:8080/v2/apps - d@<path_to_json_file>
  • 46. Mesosphere / conclusion Mesosphere DCOS is future of the data centers ! Already now it is able to gather all the zoo of technologies. 46