container orchestration on - developermarch.com€¦ · core concepts: kubernetes node: machine or...

32

Upload: others

Post on 20-May-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster
Page 2: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Container Orchestration on

Amazon Web Services

Arun Gupta, @arungupta

Page 3: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Docker Workflow

Page 4: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster
Page 5: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster
Page 6: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Development using Docker▪Docker Community Edition

– Docker for Mac/Windows/Linux – Monthly edge and quarterly stable releases – Native desktop or cloud provider experience

Page 7: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Swarm-mode: Initialize

docker swarm init --listen-addr <ip>:2377 --secret <SECRET>

Page 8: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Swarm-mode: Add Worker

docker swarm join --secret <SECRET> <manager>:2377

Page 9: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Swarm-mode: Add More Workers

docker swarm join --secret <SECRET> <manager>:2377

Page 10: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Swarm-mode: Primary/Secondary Master

docker swarm join --manager --secret <SECRET> --listen-addr <master2>:2377 <master1>:2377

Page 11: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Docker for AWS▪CloudFormation template ▪Integrated with AWS Infrastructure

– Autoscaling Groups (ASG) – Elastic Load Balancer (ELB) – Elastic Block Store (EBS)

Page 12: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster
Page 13: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Kubernetes Concepts▪Pods: collocated group of Docker containers that share an IP and storage volume ▪Service: Single, stable name for a set of pods, also acts as LB ▪Label: used to organize and select group of objects ▪Replica Set: manages the lifecycle of pods and ensures specified number are running

Node

Pod 1 Pod 2

C1 C2 C3

Pod 1

nginx

Pod 2

nginx

Service “web”

port 80 port 80

Docker

Page 14: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Core Concepts: Kubernetes▪Node: Machine or VM in the cluster ▪Master: Central control plane, provides unified view of the cluster

– etcd: distributed key-value store used to persist Kubernetes system state

▪Worker: Docker host running kubelet (node agent) and proxy services

– Runs pods and containers – Monitored by systemd (CentOS) or

monit (Debian)

Master

API Server(pods, services, …)

Controller Manager

etcdetcdetcd

Scheduler

Worker

Docker

Kubelet Proxy

Page 15: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Master

Worker

Docker

Kubelet

API Server(pods, services, …)

Controller ManagerScheduler

etcdetcdetcd

Proxy

Worker

Docker

Kubelet Proxy

kubectl

Internet

Load Balancer

Kubernetes Cluster

Page 16: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

kubectl

▪Controls the Kubernetes cluster manager ▪kubectl get pods or minions ▪kubectl create -f <filename>▪kubectl update or delete▪kubectl resize —replicas=3 replicaset <name>

Page 17: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Kubernetes on AWS▪Single node cluster

– minikube▪Multi-node cluster on AWS

– kops: github.com/kubernetes/kops – kube-aws: github.com/kubernetes-incubator/kube-aws – Heptio: github.com/aws-quickstart/quickstart-heptio

▪Google Cloud, Azure, Tectonic, OpenShift …

Page 18: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster
Page 19: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Amazon EC2 Container Service

Cluster Management

Container Orchestration

Deep AWS Integration

Page 20: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Mapping to EC2 Workloads

Instances Services Tasks

Page 21: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

http://docs.aws.amazon.com/AmazonECS/latest/developerguide/

Page 22: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Deep Integration with AWS

▪Specify IAM role used by the containers in a task ▪Services deploy and scale quickly, easily extensible

– For example, git push can trigger a deployment using CI tool ▪Scale a service up or down based upon CloudWatch alarms ▪Audit through CloudTrail, can track task/role association ▪Application Load Balancer: Define routing rules based on content

Page 23: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster
Page 24: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Mesos▪Open source cluster manager

– Developed at UC Berkeley ▪Provides resource isolation and sharing across distributed applications ▪Run distributed systems on the same pool of nodes

– Hadoop, Spark, Jenkins, … ▪Cluster monitoring ▪Tasks isolated via Linux containers

Page 25: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Mesos Architecture

http://mesos.apache.org/documentation/latest/architecture/

Page 26: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Master Master(standby)

Master(standby)

ZooKeeper Quorum

Slave Slave Slave Slave

http://mesos.apache.org/documentation/latest/architecture/

Marathon Kubernetes Spark

Aurora

Marathon

Executor

Task

Frameworks

Page 27: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Frameworks

▪Frameworks are targeted at a use case and domain-specific – Master node “offers” resources to each framework – Framework “accepts” the offer and execute applications

▪Framework has “scheduler” and “executor” – Scheduler registers with the master for “offer” – Executor launched on slave nodes to run the task

– Passes a description of the task to run

Page 28: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Master

Slave Slave Slave Slave

<s1, 4GB, 4CPU, …>

Job 1 Job 2

<s1, 2GB, 2CPU, …><s4, 4GB, 4CPU, …>

Allocation Module

Scheduler

Job 1 Job 2

Scheduler

<t1, s1, 2GB, 2CPU, …><t2, s4, 2GB, 4CPU, …>

<s4, 4GB, 4CPU, …>

<m, t1, s1, 2GB, 2CPU, …><m, t2, s4, 2GB, 4CPU, …>

1

1

23

4

4

5

http://mesos.apache.org/documentation/latest/architecture/

Page 29: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

DC/OS on AWS▪CloudFormation template ▪Basic

– Easy to get started, minimal setup required – Great for simple production deployment, demos and testing – Limited customization options

▪Advanced – Highly customizable – More setup work is required

Page 30: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

Thanks!Arun Gupta, @arungupta

github.com/javaee-samples/docker-java/tree/master/slides

Page 31: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

www.modsummit.com

www.developersummit.com

Page 32: Container Orchestration on - developermarch.com€¦ · Core Concepts: Kubernetes Node: Machine or VM in the cluster Master: Central control plane, provides unified view of the cluster

www.modsummit.com

www.developersummit.com