with swarm mode, mesos/marathon and kubernetes

59
CONTAINER ORCHESTRATION WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES ADRIAN MOUAT

Upload: dinhkhanh

Post on 13-Feb-2017

236 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

CONTAINERORCHESTRATIONWITHSWARMMODE,MESOS/MARATHONANDKUBERNETES

ADRIANMOUAT

Page 2: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

WHOAMI?ChiefScientistatContainerSolutionsWrote"UsingDocker"forO'Reilly40%discountwithcodeAUTHD

DockerCaptain@adrianmouat

Page 3: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

WHATISORCHESTRATION?

OxfordEnglishDictionary

"Theplanningorcoordinationoftheelementsofasituationtoproduceadesiredeffect,

especiallysurreptitiously"

Page 4: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

"Theplanningorcoordinationoftheelementsofasituationtoproduceadesiredeffect,

especiallysurreptitiously"

Page 5: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

ELEMENTSContainersHostsNetworking

Page 6: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

"Theplanningorcoordinationoftheelementsofasituationtoproduceadesiredeffect,

especiallysurreptitiously"

Page 7: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

DESIREDEFFECTRunningapplicationAutomaticallyscaleFaulttolerantfailover,noderebalancing,healthchecks

UseresourcesefficientlyLittlemanualintervention

Page 8: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

"Theplanningorcoordinationoftheelementsofasituationtoproduceadesiredeffect,

especiallysurreptitiously"

Page 9: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

SURREPTITIOUSLY

OxfordEnglishDictionary

"Inawaythatattemptstoavoidnoticeorattention;secretively"

Page 10: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

SURREPTITIOUSLYShouldhappeninthebackgroundUserdoesn'tneedtodetailsComplexityishidden

Page 11: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

HOWIMPORTANTISORCHESTRATION?MightnotneeditforsmallappsNoorchestration==manualorchestrationManuallyplacecontainers,network,scale,check,update

Page 12: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

COMPARINGORCHESTRATORS

Page 13: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

COMPARINGORCHESTRATORSAllworkandareimprovingrapidly

Understandthedifferences

Understandyourrequirements

Pleasedon'trollyourown!

Page 14: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

THEPLAYERSKubernetes

Mesos

DockerSwarmMode

Plusothers

Nomad,PaaSs...

Page 15: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

SIDENOTE-THEBORG/OMEGAPAPERSInfluentialpapersfromGoogleLessonslearntfrom10yearswithcontainersBothhigh-levelandtechnicalreportsKubernetes,DockerSwarmandNomad

Page 16: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

WELCOMETOTHESOCKSHOP!

Page 17: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

MICROSERVICEREFERENCEAPPLICATIONIntendedtohelppeoplegetstartedwithmicroservicesGreatforcomparingframeworksetcSimilarto"PetStore"forJava...orTodoMVCforJavaScript

Page 18: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

LOTSOFIMPLEMENTATIONSALREADYhttps://github.com/microservices-demo/microservices-demo/tree/master/deploy

Page 19: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

ARCHITECTURE

Page 20: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

DEMO

Page 21: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

DOCKERSWARMMODE

Page 22: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

SWARMMODENewinDocker1.12

DockerInc'sofficialsolution

Partofcoredistribution

MajorimprovementoveroldSwarm

Page 23: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

CORECOMPONENTSManagernodescoordinateviaRaftnoneedforseparateetcd/zookeeper

Workernodes

Page 24: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

SNAPTOINSTALL$dockerswarminitSwarminitialized:currentnode(ejgr3igiwu7mdvescuncyfq19)isnowamanager.

Toaddaworkertothisswarm,runthefollowingcommand:

dockerswarmjoin\--tokenSWMTKN-1-5cubmn41arycoxa2hk4iu6gmauzafros4vhvnq8ftp0cuacn2u-2jxkuoimbzzoow00wuyxhf1mo\10.34.9.126:2377

Toaddamanagertothisswarm,run'dockerswarmjoin-tokenmanager'andfollowtheinstructions.

Page 25: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

SECURECOMMSBYDEFAULTTLSsetupusingself-signedcertsCertificatesautomaticallyrotated

Page 26: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

OTHERFEATURESSpreadschedulingchooses"leastloaded"nodemoreoptionslatersupportforreserving&limitingcpu/mem

GlobalorReplicamode"MeshNetworking"

Page 27: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

CONSTRAINTSANDFILTERSControlwhichnodeacontainercanbescheduledonE.g:Onlynodeslabeled"staging"OnlynodeswhichhavetheimageOnlythenoderunningagivencontainer

Page 28: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

RUNNINGSOCKSHOP

(notetherepocurrentlyneedsupdatedin-linewithversionshownintalk)

https://raw.githubusercontent.com/microservices-demo/microservices-demo/master/deploy/swarmkit/start-swarmkit-services.sh

Page 29: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

SWARMMODEADVANTAGESSnaptoinstallSecurebydefaultBundledwithDocker

Page 30: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

SWARMMODEDISADVANTAGESNew

SomeDockerfeaturesunsupported

DABstillWIP

NoconceptofPods

Page 31: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES
Page 32: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

MESOSPredatesDocker

Usedbylargecompanies

Twitter,Airbnb,eBay...

Mixedload

RunHadoopjobsnexttoDockeretc

Page 33: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

CORECOMPONENTSContainerizerMesosAgentsMesosMasterZooKeeperFrameworks

Page 34: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

CONTAINERIZERResponsibleforrunningisolatedprocessInourcaseaDockerimageEitheruseDockerorinternalruntime

Page 35: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

SIDENOTE-CONTAINERRUNTIMESBothMesosandKubernetesmovingawayfromDockerMesostoitsownruntimeK8sbecoming"runtimeagnostic"inrealityrktorrunc

Youprobablyshouldn'tcareAslongasitcanrunDocker/OCIimagesDeveloperswillstilluseDocker

Page 36: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

MESOSAGENTSRunsonnodesresponsibleforexecutingtasksSubmitavailableresourcestomaster

Page 37: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

MESOSMASTERSendstaskstoagentsOffersresourcestoframeworks

Page 38: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

ZOOKEEPERDistributedHAdatabaseUsedprimarilyforkeepingtrackofcurrentmaster

Page 39: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

FRAMEWORKSCoordinatewithmastertoscheduletasksMultipleframeworksavailableCanberuntogetherMarathon,Aurora,Chronos,ElasticSearch

Page 40: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES
Page 41: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

RUNNINGSOCKSHOPhttps://raw.githubusercontent.com/microservices-demo/microservices-demo/master/deploy/mesos-

marathon/marathon.json

Page 42: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

MESOSADVANTAGESBattle-testedGUIFrameworks

Page 43: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

MESOSDISADVANTAGESNeeds3rdpartytoolsnetworkingloadbalancingservicediscovery

MarathonJSONcouldbecleaner

Page 44: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

KUBERNETES

Page 45: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

KUBERNETESBasedonGoogle'sexperiencerunningcontainersBakesinvariousfeaturesLoad-balancing,secretmanagement

Moreopinionated

Page 46: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

CORECONCEPTSPodsFlatnetworkingspaceLabelsServicesDeploymentsReplicaSets

Page 47: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

PODSGroupsofcontainersdeployedandscheduledtogetherAtomicunitContainersinapodshareIPaddressSinglecontainerpodsarecommonPodsareephemeral

Page 48: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

FLATNETWORKINGSPACEAllpodsareinthesamenetworkspaceSimplecrosshostcommunication

Page 49: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

LABELSK/Vpairsattachedtoobjects(primarilypods)e.g:"version:dev","tier:frontend"

LabelselectorsthenusedtoidentifygroupsUsedforload-balancingetc

Page 50: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

SERVICESStableendpointsaddressedbynameForwardtraffictopodsPodsareselectedbylabelsRound-robinload-balancingSeparatesendpointfromimplementation

Page 51: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

DEPLOYMENTS&REPLICASETSReplicaSetsmonitorstatusofPodsstart/stoppodsasneeded

DeploymentsstartReplicaSetsRollout/Rollback&Updates

Page 52: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

RUNNINGSOCKSHOPhttps://github.com/microservices-demo/microservices-

demo/blob/master/deploy/kubernetes/complete-demo.yaml

Page 53: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

KUBERNETESADVANTAGESAdvancedfeaturesbaked-inLotofmomentumbehindthecommunity

Page 54: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

KUBERNETESDISADVANTAGESHardertogetstartedExtraconcepts

Page 55: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

OTHERCONSIDERATIONSPersistentDataVolumes

SecretsAuto-scalingMulti-tenancyHealthchecksUpdatesandmaintenanceImagesandplatform

Federation

Page 56: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

CONCLUSIONSDifferentoptionswithdifferentstrengthsInsomewayssurprisinglysimilarHardtopredictawinnerAllaremuchbetterthanrolling-your-own

Page 57: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

SwarmMode

EasytodeploySecurebydefaultWIP

Mesos/Marathon

Battle-testedLackssomefeaturesFrameworks

Page 58: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

KubernetesLotofmomentumAdvancedfeatures

Page 59: WITH SWARM MODE, MESOS/MARATHON AND KUBERNETES

REFERENCES

GooglePapers

SockShopReferenceApplicationTNSArticleonSockShop

Large-scaleclustermanagementatGooglewithBorg(2015)Omegaflexible,scalableschedulersforlargecomputeclusters(2013)Borg,Omega,andKubernetes(2016)