Date post: | 22-Jan-2018 |
Category: |
Software |
Upload: | cristiano-altmann |
View: | 341 times |
Download: | 2 times |
Microservices with Spring
Cloud and Kubernetes
About Cristiano Altmann
● Desenvolvedor de software +10 anos
● Ilegra desde novembro / 2016
● Interesse:
○ Microservices
○ Reactive services
○ Event source + cqrs
● https://www.linkedin.com/in/crisaltmann/
About José Porto
● Desenvolvedor de software +10 anos
● Ilegra desde agosto / 2016
● Interesse:
○ Microservices
○ Big Data
○ Functional Programming
● https://www.linkedin.com/in/jose-eduardo-porto/
Summary
● Motivations
● High level architecture
● Kubernetes
● Spring cloud
● Conclusion
Motivations
● Organizational
○ IT Delivery
○ Legacy system
○ Multiple squads, same software
● TI
○ Scale
○ Operational costs
● Business
○ Time to market
High Level Architecture
MS A MS B MS C
High Level Architecture
MS A MS B MS C
Kubernetes
Kubernetes is an open-source system for
automating deployment, scaling, and
management of containerized applications.
Kubernetes
● Create by Google
● Active community (RedHat, Google, …)
● Scheduler
● Hybrid (public or private cloud)
● API REST
Kubernetes - concepts
● Deployment
● Pod
● Service
● Node
● Replication controller
Kubernetes - Node
● Worker machine
● Where pods are running
Kubernetes - Deployment
● Configure a desired state
○ Number of replicas
○ Docker image
○ Readiness and liveness probe
○ Environment Variables
● Replica Controller read and control the cluster based on it.
● Namespace
Kubernetes - Deployment
Kubernetes - Pod
● Instance of a deployment
● Pod is the container in execution
● Replication Controller delete, restart and create pods
Kubernetes - Pod
● Instance of a deployment
● Pod is the container in execution
● Replication Controller delete, restart and create pods
Kubernetes - Deployment - Pod
Kubernetes - Service
● Pods are mortal
● Dynamic ip and port
● Select pod by label
● Load Balancer
● Provide external access
Kubernetes - Summary
Kubernetes - Zero downtime
● Readiness probe
● Liveness probe
Spring Cloud
MS A MS B MS C MS A MS B MS C
Spring Cloud
MS A MS B MS C MS A MS B MS C
Technologies
● Java 8
● Spring Boot
● NodeJS
Spring Cloud Netflix
● Dados gerais do netflix
Ribbon
● Integration with service discovery
● Fault tolerance
● Clients integrated with load balancers
● Implements Circuit Breaker pattern
● Support to protocols (HTTP, TCP, UDP)
● RoundRobinRule
● AvailabilityFilteringRule
● WeightedResponseTimeRule
Ribbon - Load Balanced Rules
Ribbon - Load Balanced
Service A
Service B
Service B
Ribbon - Load Balanced
Service A
Service B
Service B
Ribbon
Ribbon
Ribbon
Ribbon
Feign
● Connection to HTTP APIs
● Uses minimal overhead and code
● Abstraction for Ribbon and Hystrix
Feign
Feign
Feign
Hystrix
● Circuit break pattern
● Timeout
● Fallback
● Real-time operations
● Concurrency
Hystrix - Circuit Breaker
Hystrix
Service A Service B Service C
API
Browser Mobile
Hystrix
Service A Service B Service C
API
Browser Mobile
Fallback
Hystrix - Fallback Method
Hystrix
● Turbine stream
● Metrics from Dashboard
● Several indicators:
○ Circuit state
○ Latency
○ Request rate
○ Error percentage from 10 last requests
Hystrix - Config App
Hystrix - Stream
Hystrix - Dashboard
Spring Cloud Config
● Config model spring (application, profile, label)
● Multiple EnvironmentRepository
○ GIT
○ JDBC
○ Filesystem
○ Vault
● Authorization
● Lightweight
● REST API
Spring Cloud Config
● Fast and easy to deploy applications
● Metrics
● Resilience
● Easy monitoring
● Services separate by squad
● DevOps
● Delivery speed
Conclusions