A Primer to Containerization & Microservices
-
Upload
shiju-varghese -
Category
Technology
-
view
336 -
download
2
Transcript of A Primer to Containerization & Microservices
![Page 1: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/1.jpg)
APrimertoContainerization&Microservices
ShijuVarghese
![Page 2: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/2.jpg)
AboutMe
• ConsultingSolutionsArchitect• FocusedonGoandGoogleCloud
@shijucv|https://medium.com/@shijuvar
![Page 3: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/3.jpg)
![Page 4: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/4.jpg)
Agenda
• IntroductiontoMicroservices• IntroductiontoContainerization• AnOverviewofContainerEcosystem• MicroservicesonContainers
![Page 5: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/5.jpg)
Microservices
![Page 6: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/6.jpg)
Monolith Microservices
• Composedofasuiteofsmallservices.
• Eachservicerunsinitsownprocess.
• Greaterflexibilityforscalability.
• PutallbusinesscapabiliKesintoasingleapplicaKon.
• ApplicaKonrunsinasingleprocess.
• Scaleshorizontallybyrunning
mulKpleinstancesofmonolith.
![Page 7: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/7.jpg)
Microservicesisanarchitecturalstyleinwhichsoftwareapplicationsarecomposedofasuiteofindependentlydeployable,small,modularservices.EachoftheseMicroservicesfocusesoncompletingonetaskthatrepresentsasmallbusinesscapability.Theycommunicatewitheachotherusinglanguage-agnosticprotocolssuchasRepresentationalStateTransfer(REST),ormessagingsystems.Inanutshell,Microservicesaresmall,autonomousservicesthatworktogether.
![Page 8: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/8.jpg)
» Softwarebrokenupintofunctionalcomponents.» ComponentizationviaServicesinwhicheachserviceispackagedasoneunitofexecution.
» Independent,autonomousprocesswithnodependencyonotherMicroservices.
» Servicesareorganizedaroundbusinesscapability.» DecentralizationofDataManagement.» Independentlyreplaceableandupgradeable.
AutonomousServicesaroundBoundedContext
![Page 9: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/9.jpg)
CommunicationbetweenServices
» Synchronous» REST
» Asynchronous» AMQP» RabbitMQ,ApacheKafka,CloudnativePub/Sub
![Page 10: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/10.jpg)
KeyBenefits
» Tacklestheproblemofcomplexity.» FlexibilityforPolyglottechnologystack.» Resilience.» FlexibilityforScalability.» EaseofDeployment.» OrganisationalAlignment.» Composability.» OptimisingforReplaceability.
![Page 11: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/11.jpg)
DeployingMicroservices
![Page 12: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/12.jpg)
UnitofDeployment
» PhysicalServer» VirtualMachine(VM)» Container
![Page 13: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/13.jpg)
DeploymentPatterns
» MultipleServiceInstancesperHost» ServiceInstanceperHost» ServerlessDeployment» AWSLambda» GoogleCloudFunctions
![Page 14: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/14.jpg)
RunningMicroservicesonContainers
![Page 15: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/15.jpg)
Acollectionofindependent,autonomouscontainersparticipatinginanapplicationdefinestheMicroservicesarchitecture.
Microservices-UnitofDeploymentofasContainer
![Page 16: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/16.jpg)
Container
» LightweightLinuxenvironment.» Hermeticallysealed,deployableapp.» Separateappsfrominfrastructure.» DevelopappagainstanidealizedOS-AstaticLinuxenvironment.
» PopularizedandrevolutionizedbyDocker.
![Page 17: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/17.jpg)
WhyDoDevelopersLikeIt?
» Reliabledeployment» Staticapplicationenvironment;Immutableinfrastructure
» Portability» Separateapplicationsfromwhereitruns» Repeatablerunnableartifact» Runanywhere
» SpeedandLightweight» Bootsinseconds» 100-1000containersononemachine.
» LooselyCoupled» ComposeappsfromautonomousMicroservices
![Page 18: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/18.jpg)
Docker
Dockerisanopen-sourceenginetoeasilycreatelightweight,portable,self-sufficientcontainersfromanyapplication.Thesamecontainerthatadeveloperbuildsandtestonalaptopcanrunatscale,inproduction,onVMs,privatecloud,publiccloudsandmore.
![Page 19: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/19.jpg)
» Openplatformforcontainers.» Anecosystemforbuild,ship,andrundistributedapplications.
» Alightweightcontainervirtualizationplatform.» BuiltonLinuXContainers(LXC)» WritteninGolanguage.
![Page 20: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/20.jpg)
ComponentsofDocker
» Docker-Aportable,lightweightruntimeandpackagingtoolforbuildingcontainerizedapps.
» DockerHub-SoftwareasaServiceplatformforsharingandmanagingDockerimages.
![Page 21: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/21.jpg)
DockerFundamentals
» DockerImages-Imagesholdyourapps.» DockerRegistries-RegistryforsharingDockerimagesviaDockerHuborprivateregistrysystem.
» DockerContainers-CreatecontainersfromDockerimagestorunapps.
» Dockerfile-Atextdocumentthatcontainsinstructionstobuildadockerimage.
![Page 22: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/22.jpg)
DockerCompose
Composeisatoolfordefiningandrunningmulti-containerDockerapplications.
![Page 23: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/23.jpg)
#golangimagewhereworkspace(GOPATH)configuredat/go.FROMgolang
#Copythelocalpackagefilestothecontainer’sworkspace.ADD./go/src/github.com/shijuvar/go-web/taskmanager
#SettingupworkingdirectoryWORKDIR/go/src/github.com/shijuvar/go-web/taskmanager
#GetgodepsformanagingandrestoringdependenciesRUNgogetgithub.com/tools/godep
#RestoregodepdependenciesRUNgodeprestore
#Buildthetaskmanagercommandinsidethecontainer.RUNgoinstallgithub.com/shijuvar/go-web/taskmanager
#Runthetaskmanagercommandwhenthecontainerstarts.ENTRYPOINT/go/bin/taskmanager
#Servicelistensonport8080.EXPOSE8080
![Page 24: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/24.jpg)
//BuildimagefromDockerfile$dockerbuild-ttaskmanager.
//RunDockerimageandpublishingawebapp$dockerrun—publish3000:8080—namegoweb—rmtaskmanager
![Page 25: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/25.jpg)
ContainerClusters
» DockerSwarm» GoogleKubernetes» CoreOSTectonic» ApacheMesos
![Page 26: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/26.jpg)
Container-CentricMicroOS
» CoreOS» UbuntuSnappy» RancherOS» RedHatAtomicHost» VMwarePhoton
![Page 27: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/27.jpg)
ContainerizationonCloud
![Page 28: A Primer to Containerization & Microservices](https://reader034.fdocuments.net/reader034/viewer/2022042619/587b23981a28ab736c8b71b9/html5/thumbnails/28.jpg)
ContainerasaService(CaaS)
» GoogleContainerEngine» AmazonEC2ContainerService