Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Designing Cloud Native Applications
with Kubernetes
June 2017
@bibryam
2 @bibryam
Bilgin Ibryam
● Architect at Red Hat
● ASF Member
● Committer for Isis,Camel,OFBiz
● Microservices & Cloud Nati...
3 @bibryam
Agenda
● Cloud Native Ecosystems
● Kubernetes Abstractions & Primitives
● Container Design Principles
● Kuberne...
4 @bibryam
Microservices Architecture
...trades code complexity for operational complexity
5 @bibryam
Cloud Native Reach
6 @bibryam
A Good Definition
Cloud Native is structuring teams, culture and technology
to utilize automation and architect...
7 @bibryam
Common Characteristics
Applications adopting the principles of
Microservices packaged as
Containers orchestrate...
8 @bibryam
Brief Cloud (Native) History
9 @bibryam
Cloud Native Landscape
10 @bibryam
Cloud Native Ecosystems
11 @bibryam
Ecosystem Concerns
● Governance model
● Supporting organizations
● User community
● Culture, ways of working
●...
12 @bibryam
CNCF Members
13 @bibryam
CNCF Projects
14 @bibryam
Potential Future Projects
● Tracing: OpenTracing
● Messaging: NATS
● Stream Processing: Heron
● Networking: Fl...
15 @bibryam
Agenda
● Cloud Native Ecosystems
● Kubernetes Abstractions & Primitives
● Container Design Principles
● Kubern...
16 @bibryam
A Kubernetes Microservice
17 @bibryam
Common Capabilities
18 @bibryam
Common Abstractions & Primitives
● Application packaging (Container)
● Deployment unit (Pod)
● Recurring execu...
19 @bibryam
OOP Abstractions & Primitives
20 @bibryam
Java Abstractions & Primitives
21 @bibryam
K8S Abstractions & Primitives
22 @bibryam
Local & Distributed Primitives
23 @bibryam
Agenda
● Cloud Native Ecosystems
● Kubernetes Abstractions & Primitives
● Container Design Principles
● Kubern...
24 @bibryam
(SOLID) Principles of Container Design
● Single Concern Principle (SCP)
● Self-Containment Principle (S-CP)
● ...
25 @bibryam
Single Concern Principle
Patterns
● Sidecar
● Ambassador
● Adapter
● Init-container
● Defer-container
26 @bibryam
Self-Containment Principle
AntiPattern
● Locomotive
27 @bibryam
Image Immutability Principle
● Dev/prod parity
28 @bibryam
High Observability Principle
● Spring Boot Actuator
● Dropwizard Metrics
● WildFly Swarm Monitor
● MicroProfil...
29 @bibryam
Lifecycle Conformance Principle
● SIGTERM
● SIGKILL
● PreStop
● PostStart
30 @bibryam
Process Disposability Principle
● Fast startup
● Graceful shutdown
● Don’t rely on a particular instance
● Be ...
31 @bibryam
Runtime Confinement Principle
● resources.limits.cpu
● resources.limits.memory
● resources.requests.cpu
● reso...
32 @bibryam
More Container Best Practices
● Small images
● Arbitrary user IDs
● Port declarations
● Volume declarations
● ...
33 @bibryam
Agenda
● Cloud Native Ecosystems
● Kubernetes Abstractions & Primitives
● Container Design Principles
● Kubern...
34 @bibryam
Container Oriented Design Patterns
https://www.usenix.org/system/files/conference/hotcloud16/hotcloud16_burns....
35 @bibryam
More Kubernetes Patterns
Configuration Management –> ConfigMaps
Singleton Services -> replicas: 1
Initializers...
36 @bibryam
Agenda
● Cloud Native Ecosystems
● Kubernetes Abstractions & Primitives
● Container Design Principles
● Kubern...
37 @bibryam
Benefits of using Kubernetes
1) Self Service Environments
2)Dynamically Placed Applications
3)Declarative Serv...
38 @bibryam
Self Service Environments
An Environment is not a VM any longer
39 @bibryam
Dynamically Placed Applications
Forget about these manual placement strategies and...
40 @bibryam
Dynamically Placed Applications
… and trust the Scheduler
41 @bibryam
Declarative Service Deployments
Deployment config based options
42 @bibryam
Blue-Green and Canary Releases
Routing config based options
43 @bibryam
Application Resilience
For true resilience you must go outside of the JVM!
44 @bibryam
Application Resilience & Antifragility
● Infinite loops: CPU shares and quotas
● Memory leaks: OOM yourself
● ...
45 @bibryam
Service Discovery & Load Balancing
Client side – on the JVM
46 @bibryam
Service Discovery & Load Balancing
Provided by the platform
47 @bibryam
(Scheduled) Batch Jobs
Provided by the platform
Example batch jobs in Java
● JDK Timer
● ScheduledExecutorServ...
48 @bibryam
Immutable Infrastructure
Application binaries → Container
Deployment unit → Pod
Resource demands → request/lim...
49 @bibryam
Key Takeaways
1. Automate routine tasks through a cloud native platform.
(placement, updates, healthchecks, se...
50 @bibryam
Cloud Native is not Mandatory
It is not necessary to change. Survival is not mandatory.
W. Edwards Deming
Q & A
@bibryam
Kubernetes Patterns http://leanpub.com/k8spatterns
More on this topic: https://twitter.com/bibryam
Upcoming SlideShare
Loading in …5
×

Designing Cloud Native Applications with Kubernetes

4,480 views

Published on

This talk covers ecosystems, primitives, principles, patterns, and benefits of cloud-native and Kubernetes

Published in: Software
  • Hello! Get Your Professional Job-Winning Resume Here - Check our website! https://vk.cc/818RFv
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Designing Cloud Native Applications with Kubernetes

  1. 1. Designing Cloud Native Applications with Kubernetes June 2017 @bibryam
  2. 2. 2 @bibryam Bilgin Ibryam ● Architect at Red Hat ● ASF Member ● Committer for Isis,Camel,OFBiz ● Microservices & Cloud Native ● Twitter: @bibryam ● Email: bibryam@gmail.com ● Blog: http://ofbizian.com ● Github: https://github.com/bibryam
  3. 3. 3 @bibryam Agenda ● Cloud Native Ecosystems ● Kubernetes Abstractions & Primitives ● Container Design Principles ● Kubernetes Design Patterns ● Benefits of using Kubernetes
  4. 4. 4 @bibryam Microservices Architecture ...trades code complexity for operational complexity
  5. 5. 5 @bibryam Cloud Native Reach
  6. 6. 6 @bibryam A Good Definition Cloud Native is structuring teams, culture and technology to utilize automation and architectures to manage complexity and unlock velocity. Joe Beda, Heptio
  7. 7. 7 @bibryam Common Characteristics Applications adopting the principles of Microservices packaged as Containers orchestrated by Platforms running on top of Cloud infrastructure, developed using practices such as Continuous Delivery and DevOps.
  8. 8. 8 @bibryam Brief Cloud (Native) History
  9. 9. 9 @bibryam Cloud Native Landscape
  10. 10. 10 @bibryam Cloud Native Ecosystems
  11. 11. 11 @bibryam Ecosystem Concerns ● Governance model ● Supporting organizations ● User community ● Culture, ways of working ● Technology (maturity * potential) ● Complementary tools ● Documentation, conferences, books ● Coolness factor and developer happiness
  12. 12. 12 @bibryam CNCF Members
  13. 13. 13 @bibryam CNCF Projects
  14. 14. 14 @bibryam Potential Future Projects ● Tracing: OpenTracing ● Messaging: NATS ● Stream Processing: Heron ● Networking: Flannel, Calico, Weave ● Configuration: etcd ● Database: CockroachDB ● Storage: Minio
  15. 15. 15 @bibryam Agenda ● Cloud Native Ecosystems ● Kubernetes Abstractions & Primitives ● Container Design Principles ● Kubernetes Design Patterns ● Benefits of using Kubernetes
  16. 16. 16 @bibryam A Kubernetes Microservice
  17. 17. 17 @bibryam Common Capabilities
  18. 18. 18 @bibryam Common Abstractions & Primitives ● Application packaging (Container) ● Deployment unit (Pod) ● Recurring execution (CronJob) ● Service discovery & load balancing (Service) ● Application placement (Scheduler) ● Artifact grouping (Label) ● Resources isolation (Container/Namespace)
  19. 19. 19 @bibryam OOP Abstractions & Primitives
  20. 20. 20 @bibryam Java Abstractions & Primitives
  21. 21. 21 @bibryam K8S Abstractions & Primitives
  22. 22. 22 @bibryam Local & Distributed Primitives
  23. 23. 23 @bibryam Agenda ● Cloud Native Ecosystems ● Kubernetes Abstractions & Primitives ● Container Design Principles ● Kubernetes Design Patterns ● Benefits of using Kubernetes
  24. 24. 24 @bibryam (SOLID) Principles of Container Design ● Single Concern Principle (SCP) ● Self-Containment Principle (S-CP) ● Image Immutability Principle (IIP) ● High Observability Principle (HOP) ● Lifecycle Conformance Principle (LCP) ● Process Disposability Principle (PDP) ● Runtime Confinement Principle (RCP)
  25. 25. 25 @bibryam Single Concern Principle Patterns ● Sidecar ● Ambassador ● Adapter ● Init-container ● Defer-container
  26. 26. 26 @bibryam Self-Containment Principle AntiPattern ● Locomotive
  27. 27. 27 @bibryam Image Immutability Principle ● Dev/prod parity
  28. 28. 28 @bibryam High Observability Principle ● Spring Boot Actuator ● Dropwizard Metrics ● WildFly Swarm Monitor ● MicroProfile Healthchecks
  29. 29. 29 @bibryam Lifecycle Conformance Principle ● SIGTERM ● SIGKILL ● PreStop ● PostStart
  30. 30. 30 @bibryam Process Disposability Principle ● Fast startup ● Graceful shutdown ● Don’t rely on a particular instance ● Be aware of shots at your cattle ● Be robust against sudden death
  31. 31. 31 @bibryam Runtime Confinement Principle ● resources.limits.cpu ● resources.limits.memory ● resources.requests.cpu ● resources.requests.memory
  32. 32. 32 @bibryam More Container Best Practices ● Small images ● Arbitrary user IDs ● Port declarations ● Volume declarations ● Image metadata ● Host and image sync https://www.slideshare.net/luebken/container-patterns https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices http://docs.projectatomic.io/container-best-practices https://docs.openshift.com/enterprise/3.0/creating_images/guidelines.html http://blog.arungupta.me/docker-container-anti-patterns/ https://12factor.net/
  33. 33. 33 @bibryam Agenda ● Cloud Native Ecosystems ● Kubernetes Abstractions & Primitives ● Container Design Principles ● Kubernetes Design Patterns ● Benefits of using Kubernetes
  34. 34. 34 @bibryam Container Oriented Design Patterns https://www.usenix.org/system/files/conference/hotcloud16/hotcloud16_burns.pdf
  35. 35. 35 @bibryam More Kubernetes Patterns Configuration Management –> ConfigMaps Singleton Services -> replicas: 1 Initializers -> Init Container Daemon Services –> Daemon Sets Stateful Services –> StatefulSet https://leanpub.com/k8spatterns/
  36. 36. 36 @bibryam Agenda ● Cloud Native Ecosystems ● Kubernetes Abstractions & Primitives ● Container Design Principles ● Kubernetes Design Patterns ● Benefits of using Kubernetes
  37. 37. 37 @bibryam Benefits of using Kubernetes 1) Self Service Environments 2)Dynamically Placed Applications 3)Declarative Service Deployments 4)Blue-Green and Canary Releases 5)Application Resilience & Antifragility 6)Service Discovery & Load Balancing 7)Service Clustering 8)(Scheduled) Batch Jobs 9)Immutable Infrastructure
  38. 38. 38 @bibryam Self Service Environments An Environment is not a VM any longer
  39. 39. 39 @bibryam Dynamically Placed Applications Forget about these manual placement strategies and...
  40. 40. 40 @bibryam Dynamically Placed Applications … and trust the Scheduler
  41. 41. 41 @bibryam Declarative Service Deployments Deployment config based options
  42. 42. 42 @bibryam Blue-Green and Canary Releases Routing config based options
  43. 43. 43 @bibryam Application Resilience For true resilience you must go outside of the JVM!
  44. 44. 44 @bibryam Application Resilience & Antifragility ● Infinite loops: CPU shares and quotas ● Memory leaks: OOM yourself ● Disk hogs: Quotas ● Fork bombs: Process limits ● Circuit Breaker, Timeout, Retry as SideCar ● Failover and Service Discovery as SideCar ● Process Bulkheading with Containers ● Hardware Bulkheading through Scheduler ● Auto-scaling & Self-healing
  45. 45. 45 @bibryam Service Discovery & Load Balancing Client side – on the JVM
  46. 46. 46 @bibryam Service Discovery & Load Balancing Provided by the platform
  47. 47. 47 @bibryam (Scheduled) Batch Jobs Provided by the platform Example batch jobs in Java ● JDK Timer ● ScheduledExecutorService ● Quartz Scheduler ● Spring Batch
  48. 48. 48 @bibryam Immutable Infrastructure Application binaries → Container Deployment unit → Pod Resource demands → request/limit/PVC Configurations → ConfigMap/Secret Update/rollback mechanism → Deployment
  49. 49. 49 @bibryam Key Takeaways 1. Automate routine tasks through a cloud native platform. (placement, updates, healthchecks, self-healing, scaling) 2. Move XFR/NFR from application to platform layer. (service discovery, circuit breaker, jobs, configurations, logs) 3. Ecosystem matters (Bet on a complete ecosystem, not a single platform)
  50. 50. 50 @bibryam Cloud Native is not Mandatory It is not necessary to change. Survival is not mandatory. W. Edwards Deming
  51. 51. Q & A @bibryam Kubernetes Patterns http://leanpub.com/k8spatterns More on this topic: https://twitter.com/bibryam

×