Contenu connexe

Présentations pour vous(20)

Similaire à When to use Serverless? When to use Kubernetes?(20)

Plus de Niklas Heidloff(20)

When to use Serverless? When to use Kubernetes?

  1. When to use Serverless? When to use Kubernetes? Niklas Heidloff Developer Advocate, IBM @nheidloff heidloff.net H1 / 2018
  2. Agenda, Disclaimers and Credits Open Source solutions only Focus is on development related topics Focus is on compute, not on storage Thanks a lot to Ansgar Schmidt for the preparation of this session which we gave together at OOP 2018, Munich ! @nheidloff Code Intro Test Deploy Run Summary
  3. Serverless “Serverless computing is a cloud computing execution model in which the cloud provider dynamically manages the allocation of machine resources. Pricing is based on the actual amount of resources consumed by an application.” (via Wikipedia) Sample scenario: Serverless Web Application Code Intro Test Deploy Run Summary @nheidloff
  4. Apache OpenWhisk “Apache OpenWhisk is a serverless, open source cloud platform that executes functions in response to events without developer concern for managing the lifecycle or operations of the containers that execute the code.” (via Apache) Supported runtimes: Node.js, Python, PHP, Swift and Docker Deployment: On-premises or in the cloud Code Intro Test Deploy Run Summary @nheidloff
  5. Kubernetes “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications.” (via kubernetes.io) Open source projected initiated by Google and governed by the Cloud Native Computing Foundation Main functionality: Self-healing, automatic binpacking, service discovery and load balancing, horizontal scaling, automated rollouts Offered as computing option by all major cloud providers Code Intro Test Deploy Run Summary @nheidloff
  6. Istio Code Intro Test Deploy Run Summary “An open platform to connect, manage, and secure microservices.” (via istio) Open source projected initiated by IBM and Google and governed by the Cloud Native Computing Foundation Main functionality: Traffic management, observability, policy enforcement, service identity @nheidloff
  7. Code Intro Test Deploy Run Summary Kubernetes Local development via standard tooling and IDEs Minikube to run Kubernetes locally Docker support for Kubernetes (beta) @nheidloff
  8. Serverless Supported runtimes: Node.js, Python, PHP, Swift and Docker Development Local development via standard tooling and IDEs Web tooling provided by cloud providers Orchestration via Composer Code Intro Test Deploy Run Summary @nheidloff
  9. Demo 1 – Serverless APIs Building simple CRUD APIs via Node.js GET https://..../person?id=x Types of functions Single file (synchronous and asynchronous) Multi-file functions Docker functions Debugging single file Nodes.js functions Code Intro Test Deploy Run Summary @nheidloff
  10. Demo 1 – Function Code Code Intro Test Deploy Run Summary @nheidloff
  11. Demo 1 – Asynchronous Function (successful) Code Intro Test Deploy Run Summary @nheidloff
  12. Demo 1 – Multiple File Function Code Intro Test Deploy Run Summary @nheidloff
  13. Demo 1 – Multiple File Function Code Intro Test Deploy Run Summary @nheidloff
  14. Demo 1 – Debugging simple Node.js Function Code Intro Test Deploy Run Summary @nheidloff
  15. Demo 1 – Debugging simple Node.js Function Code Intro Test Deploy Run Summary @nheidloff
  16. Demo 1 – Debugging simple Node.js Function Code Intro Test Deploy Run Summary @nheidloff
  17. Demo 1 – Debugging simple Node.js Function Code Intro Test Deploy Run Summary @nheidloff
  18. Demo 2 – Debugging Docker Developing serverless functions via Docker Debugging containers locally For both Serverless and Kubernetes With Visual Studio Code Code Intro Test Deploy Run Summary @nheidloff
  19. Demo 2 – Nodes.js Function in Docker Code Intro Test Deploy Run Summary @nheidloff
  20. Demo 2 – Nodes.js Function in Docker Code Intro Test Deploy Run Summary @nheidloff
  21. Demo 2 – Nodes.js Function in Docker Code Intro Test Deploy Run Summary @nheidloff
  22. Demo 2 – Nodes.js Function in Docker Code Intro Test Deploy Run Summary @nheidloff
  23. Demo 2 – Nodes.js Function in Docker Code Intro Test Deploy Run Summary @nheidloff
  24. Demo 2 – Nodes.js Function in Docker Code Intro Test Deploy Run Summary @nheidloff
  25. Demo 2 – Debugging Nodes.js Function in Docker Code Intro Test Deploy Run Summary @nheidloff
  26. Demo 2 – Debugging Nodes.js Function in Docker Code Intro Test Deploy Run Summary @nheidloff
  27. Demo 2 – Debugging Nodes.js Function in Docker Code Intro Test Deploy Run Summary @nheidloff
  28. Demo 2 – Debugging Nodes.js Function in Docker Code Intro Test Deploy Run Summary @nheidloff
  29. Demo 2 – Debugging Nodes.js Function in Docker Code Intro Test Deploy Run Summary @nheidloff
  30. Demo 2 – Debugging Nodes.js Function in Docker Code Intro Test Deploy Run Summary @nheidloff
  31. Demo 2 – Debugging Nodes.js Function in Docker Code Intro Test Deploy Run Summary @nheidloff
  32. Demo 2 – Debugging Nodes.js Function in Docker Code Intro Test Deploy Run Summary @nheidloff
  33. Composer Composer is a new programming model for composing functions, built on Apache OpenWhisk Declarative and programmatic approach to define sophisticated flows between functions in cloud-native apps State management between ‘stateless’ functions Code Intro Test Deploy Run Summary @nheidloff
  34. Code Intro Test Deploy Run Summary Kubernetes Testing can be done via standard testing tools and services Istio provides capabilities to easily do A/B testing to test new features in production environments @nheidloff
  35. Code Intro Test Deploy Run Summary Demo 3- A/B Testing Book reviews sample application https://istio.io/docs/guides/bookinfo.html Deployments of new service versions to subsets of users @nheidloff
  36. Demo 3 – Book Info App Code Intro Test Deploy Run Summary @nheidloff
  37. Demo 3 – Book Info App: Different Review Versions Code Intro Test Deploy Run Summary @nheidloff
  38. Code Intro Test Deploy Run Summary Demo 3 - A/B Testing: 3 Versions of Review Service @nheidloff
  39. Code Intro Test Deploy Run Summary Demo 3 - A/B Testing: Version 2 only for Jason @nheidloff
  40. Code Intro Test Deploy Run Summary Demo 3 - A/B Testing: Version 3 for 50% of Users @nheidloff
  41. Serverless No good way to do A/B Testing Tests cause costs when running functions in the cloud Testing doesn’t become easier automatically “Functions” doesn’t mean necessarily “Pure Functions” Code Intro Test Deploy Run Summary @nheidloff
  42. Code Intro Test Deploy Run Summary Serverless Deployments can be automated via CD/CI pipelines No notion of staging environments for functions in the cloud Serverless Framework: Toolkit for deploying and operating serverless architectures @nheidloff
  43. Code Intro Test Deploy Run Summary Kubernetes Deployments can be done via kubectl CLI Deployments can be automated via CD/CI pipelines Helm is a tool for managing Kubernetes charts which are packages of pre-configured Kubernetes resources @nheidloff
  44. Demo 4 – Deployments Code Intro Test Deploy Run Summary Deployment of a Function via wsk CLI Deployment of Kubernetes applications Via kubectl CLI Via Helm @nheidloff
  45. Demo 1 – Deployment of Function Code Intro Test Deploy Run Summary @nheidloff
  46. Demo 1 – Function Invocation via CLI Code Intro Test Deploy Run Summary @nheidloff
  47. Demo 4 – Function Invocation via HTTP Code Intro Test Deploy Run Summary @nheidloff
  48. Demo 4 – Deployment of nginx on Kubernetes Code Intro Test Deploy Run Summary @nheidloff
  49. Demo 4 – Deployment of nginx on Kubernetes Code Intro Test Deploy Run Summary @nheidloff
  50. Demo 4 – Deployment of nginx on Kubernetes Code Intro Test Deploy Run Summary @nheidloff
  51. Demo 4 – Kubernetes Scalability Code Intro Test Deploy Run Summary @nheidloff
  52. Demo 4 – Jenkins Installation via Helm Code Intro Test Deploy Run Summary @nheidloff
  53. Demo 4 – Jenkins Installation via Helm Code Intro Test Deploy Run Summary @nheidloff
  54. Serverless Limited out of the box monitoring right now, especially for Composer flows Monitoring via Grafana Serverless doesn’t always mean administrator-less On-premises deployments require operations Management of Docker containers, e.g. vulnerabilities Code Intro Test Deploy Run Summary @nheidloff
  55. Kubernetes Lots of monitoring tools available Part of Kubernetes: kubectl proxy Community and third parties: Grafana, Zipkin and many more Code Intro Test Deploy Run Summary @nheidloff
  56. Kubernetes Dashboard (kubectl proxy) Code Intro Test Deploy Run Summary @nheidloff
  57. Kubernetes: Grafana Code Intro Test Deploy Run Summary @nheidloff
  58. Kubernetes: Zipkin Code Intro Test Deploy Run Summary @nheidloff
  59. Kubernetes: ServiceGraph Code Intro Test Deploy Run Summary @nheidloff
  60. Summary Use Serverless for ... Variable and irregular loads (can lead to lower costs) Developer productivity for first time experience Inherent auto-scalability Use Kubernetes for ... Mature deployment options, e.g. A/B testing, monitoring Minimal response latency High performance computing without resource restrictions Code Intro Test Deploy Run Summary @nheidloff
  61. Resources OpenWhisk https://openwhisk.apache.org https://github.com/ibm-functions/composer https://github.com/nheidloff/openwhisk-debug-nodejs Kubernetes https://kubernetes.io https://istio.io IBM Cloud http://ibm.biz/oop2018 Code Intro Test Deploy Run Summary @nheidloff
  62. Appendix @nheidloff
  63. Abstract There is a lot of debate whether to use Serverless or Kubernetes to build cloud-native apps. Both have their advantages and unique capabilities which developers should take into consideration when planning new projects. We will throw some light on the topics ease of use, maturity, types of scenarios, developer productivity and debugging, supported languages, DevOps and monitoring, performance, community and pricing. Cloud-native architectures shift the complexity from within an application to orchestrations of Microservices. Both Kubernetes and Serverless have their strengths which we will discuss. Besides the core development topics, developers should also understand operational aspects how complicated it is to maintain your own systems versus using managed platforms. @nheidloff
  64. API Management with IBM Cloud Code Intro Test Deploy Run Summary @nheidloff
  65. Serverless – Demo 1 Code Intro Test Deploy Run Summary @nheidloff
  66. Serverless – Demo 1 Code Intro Test Deploy Run Summary @nheidloff
  67. Serverless – Demo 1 Code Intro Test Deploy Run Summary @nheidloff
  68. Serverless – Demo 1 Code Intro Test Deploy Run Summary @nheidloff
  69. Serverless – Demo 1 Code Intro Test Deploy Run Summary @nheidloff