Microservices & Containers - Docker Bangalore Meetup #12

Download Microservices & Containers - Docker Bangalore Meetup #12

Post on 28-Jul-2015




2 download

Embed Size (px)


1. 2015 ARAVIND AJAD YARRA < 1 > MICROSERVICES & CONTAINERS m a k i n g s e r vi c e s w o r k 2. 2015 ARAVIND AJAD YARRA < 2 > ARAVIND AJAD YARRA Software Architect & Engineer for 19 years Distinguished Member of Technical Staff at Wipro 3. 2015 ARAVIND AJAD YARRA < 3 > MICROSERVICES QUICK INTRODUCTION TO MICROSERVICES 4. 2015 ARAVIND AJAD YARRA < 4 > SOA CURRENT STATE ORCEHSTRATION BUSINESS LOGIC CHANNELS OLTP WORK-FLOW DASH BOARDS CORE SYSTEMS LEGACY SYSTEMS DATA WAREHOUSE S PARTNER SYSTEMS ENTERPRISE SERVICE BUS GOVERNANCE CONNECTIVITY SERVICE PROVIDERS/ CLIENTS SERVICE CLIENTS/ PROVIDERS SOA INTEGRATION MIDDLEWARE Service Oriented Architectures are currently adopted in Enterprise Integration. 5. 2015 ARAVIND AJAD YARRA < 5 > MONOLITH ARCHITECTURE RWD MVC Quote HomeCommercial Cross SellCart Rules Ref Data Bundles ResumeCaching Document Payment Integration Validations Auto Data Store Life UI JAVAEE CONTAINER Monolith architectures have components bundled together with tight dependencies. Change or failure in a component will result in fragility, there by makes it difficult to evolve the architecture. 6. 2015 ARAVIND AJAD YARRA < 6 > MICROSERVICES HomeQuote CommercialQuote Recommendations Cart BundleManagement Caching Document Payment AutoQuote Service Oriented Independently managed Loose Coupling Connected Applying service oriented architecture principles to monolith system architectures 7. 2015 ARAVIND AJAD YARRA < 7 > WHY CONTAINERS? PRACTICAL CONSIDERATIONS FOR MICROSERVICES 8. 2015 ARAVIND AJAD YARRA < 8 > KEY CONSIDERATIONS Design and development of services - Service capabilities such as connectivity, discovery and monitoring Deploy self-contained services. Continuous deployment of services enable evolution & continuous availability Configure services externally without fixed assumptions Transparently discover dependent services. Find failed services and connect to resumed services. Manage services and Monitor service specific metrics, events and logs 9. 2015 ARAVIND AJAD YARRA < 9 > KEY CHALLENGES Lightweight How not to add overhead? Self-contained How do we make services portable across environments? How do we isolate service processes? Continuous deployment How to deploy services rapidly without any disruption? Setup & Discovery How to setup services and add dependencies? Elastic Scaling - How to scale services transparently? Monitor How to monitor services and failures? Application Stacks have grown up to handle these. How about infrastructure? 10. 2015 ARAVIND AJAD YARRA < 10 > DOCKER MADE FOR S Docker makes an excellent choice for micro-services. But is it enough? Isolation : One process per container Lightweight : No virtualization overhead Self-contained : Package all the hard dependencies together Portable : Easily pull images into any environment 11. 2015 ARAVIND AJAD YARRA < 11 > CONTAINER ORCHESTRATION Orchestrate containers to facilitate micro-services architecture Provision Containers Manage Container Dependencies Enable Discovery Handle Container Failure Scale Containers Amazon ECS 12. 2015 ARAVIND AJAD YARRA < 12 > BRINGING IT ALL TOGETHER HOW TO MAKE ALL THIS WORK? 13. 2015 ARAVIND AJAD YARRA < 13 > KUBERNETES CLUSTER Master Minion pod pod labels labels kubelet cAdvisor proxy API Server Minion pod pod labels labels kubelet cAdvisor proxy scheduler replication controller kubectl distributed storage 14. 2015 ARAVIND AJAD YARRA < 14 > PACKAGING S Packaging a microservice involves creating a executable JAR or equivalent. Use Onejar or Spring Boot to build a fat jar with all dependencies Create Docker image with the executable for microservice. Use caching as required Pod is the abstraction for a basic unit of a S in Kubernetes. Create a Pod with docker image. 15. 2015 ARAVIND AJAD YARRA < 15 > SCALING S Replicating Pods is easy and will replicate containers (& microservices) Kubernetes replication controllers are best way to achieve replication Replica count can be incremented or decremented as required dynamically using kubectl or Kubernetes API BTW, replication controllers can help in resiliency 16. 2015 ARAVIND AJAD YARRA < 16 > LOAD BALANCING Load balancing can be enabled using the Service construct of Kubernetes. Service is essentially a proxy on top of Pod. kube-proxy Pod #2 Labels: quoteservice Port: 8080 Pod #3 Labels: quoteservice Port:8080 Pod #1 Labels: quoteservice Port:8080 Load balancing is done using selectors on labels Pods are ephemeral and they can come up and go. Service will resolve those pods randomly. 17. 2015 ARAVIND AJAD YARRA < 17 > BG DEPLOYMENT service Pod #2 Labels: quoteservice Port: 8080 Pod #3 Labels: quoteservice Port:8080 Pod #1 Labels: quoteservice Port:8080 service Pod #2 Labels: quoteservice Port: 8080 Pod #3 Labels: quoteservice Port:8080 Pod #1 Labels: quoteservice Port:8080 X Pod #4 Labels: quoteservice Port:8080 Services enables blue-green deployments for continuous deployment Services also enable other patterns such as canary releases, taking off instances for debugging and so on replcontroller#1#2 18. 2015 ARAVIND AJAD YARRA < 18 > SERVICE DISCOVERY Environment Variables kubelet adds environment variables for every service that is active in the cluster microservices can leverage these environment variables for resolving dependencies SkyDNS with DNS cluster add-on Injects SkyDNS (+etcd) to environment variables SkyDNS is populated with active services from kubernetes master Higher order frameworks Consul Eureka 19. 2015 ARAVIND AJAD YARRA < 19 > SERVICE MONITORING Docker Process Monitoring Kubelet monitors docker process constantly Failure of docker process triggers restart of the pod based on policy Application Level Health Checks HTTP Health Check Kubelet calls a HTTP endpoint Container Exec Kubelet calls a container command Higher Order Frameworks Hystrix + Eureka Metrics & Log Monitoring Heapster Fluentd + Elasticsearch 20. 2015 ARAVIND AJAD YARRA < 20 > WATCH OUT Orchestration of containers for stateful microservices Limited controller capabilities Rapidly evolving Not yet ready for production Limited management capabilities Tooling is yet to catch-up Read the small print 21. 2015 ARAVIND AJAD YARRA < 21 > THANK YOU @aravindajad www.slideshare.net/AravindAjad MAERSK CREATIVE COMMONS