Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Knative and Kubernetes - more serverless for mo...

Knative and Kubernetes - more serverless for more developers

(From 2018) Kubernetes and Istio provide a great foundation for orchestrating, monitoring, and scaling your apps. They're open source and work great in your data center or in any major cloud. Meanwhile, the serverless development model has empowered devs to build software faster than ever by eliminating concerns like scaling, networking, load balancing, OS patching, etc.

Come learn how you can combine the power of Kubernetes with the ease of use of serverless to create new, powerful and flexible development experiences.

See me give this talk in 2018 at https://www.youtube.com/watch?v=bYxOx9tcYDE&ab_channel=Devoxx

----

About Bret McGowen
Bret is a Developer Advocate for Serverless on the Google Cloud Platform team at Google, focusing on serverless products like Google Cloud Functions, App Engine, Firebase, machine learning APIs, and more. He's currently an aspiring Node.js developer. Prior to Google, Bret worked as a software engineer in the cloud industry at Rackspace. Before that, he led engineering teams at e-commerce and non-profits and tried his hand at creating two startups. He's often on the running trail, volleyball court or kickball field.

Bret earned a bachelor’s degree in computer science from Texas A&M University.

Reach Bret on Twitter at @bretmcg

More Decks by Bret McGowen - NYC Google Developer Advocate

Other Decks in Technology

Transcript

  1. @BretMcG github.com/bretmcg Knative and Kubernetes: Bringing serverless to more developers

    Bret McGowen @BretMcG Developer Advocate Google linktr.ee/bretmcg Connect with me GitHub - github.com/bretmcg SlideShare - slideshare.net/bretmc My LinkTree - inktr.ee/bretmcg YouTube - youtube.com/c/BretMcG Speaker Deck - speakerdeck.com/bretmcg Sessionize - sessionize.com/bretmcg LinkedIn - linkedin.com/in/bretmcgowen Instagram - instagram.com/bret.mcgowen
  2. @BretMcG github.com/bretmcg Serverless model(s) Operational model Fully managed security Pay

    only for usage No servers Event-driven Open Service-based Programming model
  3. @BretMcG github.com/bretmcg Keep the serverless programming model, however your infrastructure

    is managed. Operational model Fully managed security Pay only for usage No servers Event-driven Open Service-based Programming model
  4. @BretMcG github.com/bretmcg Hosted FaaS/compute Easiest dev experience Code focused Limited

    runtime options Serverless anywhere Knative / GKE serverless addon On prem or multi-cloud Code or containers Custom hardware (GPU, TPU, IoT, etc) Offline You manage infra Serverless operational spectrum Managed by your cloud Container orchestration (k8s) Not serverless for programming or ops Container focused You manage infra Managed by your team Serverless containers Custom languages & runtimes Infra still cloud-managed
  5. @BretMcG github.com/bretmcg Hosted FaaS/compute Easiest dev experience Code focused Limited

    runtime options Hosted FaaS/compute Managed by your cloud Container orchestration (k8s) Not serverless for programming or ops Container focused You manage infra Managed by your team Serverless anywhere Knative / GKE serverless addon On prem or multi-cloud Code or containers Custom hardware (GPU, TPU, IoT, etc) Offline You manage infra Serverless containers Custom languages & runtimes Infra still cloud-managed
  6. @BretMcG github.com/bretmcg Serverless Compute on Cloud Platform App Engine Standard

    Highly scalable, serverless web applications. Deploy and scale Applications that react to Requests Cloud Functions Event-driven serverless compute platform. Deploy and scale Functions that react to Events
  7. @BretMcG github.com/bretmcg Back end code functions that automatically run in

    response to a trigger event Microservices Cloud "glue" Node.js 6, Node.js 8, Python 3.7, Go 1.11 (bit.ly/gcf-go-alpha) Pricing: per 100ms & based on allocated memory Cloud Functions
  8. @BretMcG github.com/bretmcg Cloud Functions as cloud glue Access 20+ Google

    services from GCF Cloud Storage Cloud Pub/Sub HTTPS Firebase Cloud Scheduler
  9. @BretMcG github.com/bretmcg Cloud Functions announcements Generally Available (with SLA!) Python

    3.7, Node 8 Tokyo, Belgium, Iowa Environment Variables Cloud Scheduler New! Ubuntu 18.04 with many packages (ffmpeg, imagemagick, headless Chrome) Security Controls: VPC, IAM Scaling Controls Cloud SQL Direct Connect
  10. @BretMcG github.com/bretmcg App Engine: 2nd generation runtimes New! Pay for

    what you use, scale to zero Open-source, idiomatic experience Use any module, extension, or framework New supported runtimes: ◦ Node.js 8 ◦ Python 3.7 ◦ PHP 7.2
  11. @BretMcG github.com/bretmcg Serverless containers Managed by your cloud Container orchestration

    (k8s) Not serverless for programming or ops Container focused You manage infra Hosted FaaS/compute Easiest dev experience Code focused Limited runtime options Managed by your team Serverless anywhere Knative / GKE serverless addon On prem or multi-cloud Code or containers Custom hardware (GPU, TPU, IoT, etc) Offline You manage infra Serverless containers Custom languages & runtimes Infra still cloud-managed
  12. @BretMcG github.com/bretmcg What are containers? app libs kernel libs app

    app kernel app libs libs kernel kernel libs app kernel libs app libs app libs app kernel libs app app app app Shared machines Virtual Machines Containers x x x x x x No isolation Common libs Highly coupled apps and OS Isolation No common libs Expensive and inefficient Hard to manage Isolation No common libs Less overhead Less dependency on host OS
  13. @BretMcG github.com/bretmcg FROM python RUN apt-get update && apt-get install

    -y blender ENV APP_HOME /app COPY . $APP_HOME WORKDIR $APP_HOME RUN pip install Flask EXPOSE 8080 CMD ["python", "app.py"] Don't be afraid of this Image It’s a method of packaging an application executable and its dependencies (runtime, libraries, configuration) Runtime and running as a set of resource-isolated processes.
  14. @BretMcG github.com/bretmcg Everything at Google runs in containers: Gmail, Web

    Search, Maps, ... MapReduce, batch, ... GFS, Colossus, ... Even GCE itself: VMs in containers We launch over 4 billion containers per week.
  15. @BretMcG github.com/bretmcg Two serverless challenges today Dependencies Constrained runtimes, frameworks

    and packages Multi-Cloud Unable to run your workloads on-prem, in the cloud or on a third party service provider 1 2
  16. @BretMcG github.com/bretmcg Serverless containers Secure on gVisor Fully managed BYO

    workloads Pay for use & stateless Alpha invitations coming later this year Sign up: g.co/serverlesscontainers New: serverless containers on GCF (EAP)
  17. @BretMcG github.com/bretmcg Serverless anywhere Knative / GKE serverless addon On

    prem or multi-cloud Code or containers Custom hardware (GPU, TPU, IoT, etc) Offline You manage infra Serverless anywhere Managed by your cloud Container orchestration (k8s) Not serverless for programming or ops Container focused You manage infra Hosted FaaS/compute Easiest dev experience Code focused Limited runtime options Managed by your team Serverless containers Custom languages & runtimes Infra still cloud-managed
  18. @BretMcG github.com/bretmcg Knative isn't Not an open source FaaS developer-facing

    product It's primitives, not a product Not the right solution for everyone
  19. @BretMcG github.com/bretmcg Knative Build Serving Events Kubernetes + Istio Platform

    Products Serverless Containers on GCF GKE Serverless Add-on SAP Kyma Pivotal Function Service IBM Cloud Functions Red Hat Cloud Functions Primitives riff OpenFaaS Jazz
  20. @BretMcG github.com/bretmcg *Sources: COCOMO Model, CNCF.io Certified Providers 442 Years

    of effort* 5,000+ Contributors 30k+ GitHub stars The incredible Kubernetes ecosystem
  21. @BretMcG github.com/bretmcg Isolation: Keep jobs from interfering with each other

    Scheduling: Where should my job be run? Lifecycle: Keep my job running Discovery: Where is my job now? Constituency: Who is part of my job? Scale-up: Making my jobs bigger or smaller Auth{n,z}: Who can do things to my job? Monitoring: What’s happening with my job? Health: How is my job feeling? Container orchestration
  22. @BretMcG github.com/bretmcg Developers using Kubernetes still have a lot to

    do Have to do Write code Build docker image Upload image to registry Deploy service Expose to the internet Setup logging & monitoring Scale workload Want to do Write code
  23. @BretMcG github.com/bretmcg Reasons for using Kubernetes (2014) vs hosted serverless

    (2014) Reduce lock-in Performance Multi-cloud Customizability Use custom hardware (GPU, TPU, IoT, etc) Offline/reduced connectivity Existing on-prem infrastructure Existing applications
  24. @BretMcG github.com/bretmcg Everybody got all fired up about Kubernetes and

    microservices and then were like ‘Oh s----, what’s going on?’ Istio lets us view our entire system and find trouble spots. Anonymous early adopter Observability:
  25. @BretMcG github.com/bretmcg Example: canaries & traffic steering destination: pictures.example.local match:

    httpHeaders: user-agent: regex: ^(.*?;)?(iPhone)(;.*)?$ precedence: 2 route: - tags: version: 2.0-alpha env: staging pictures version: 2.0-alpha env: staging version: 1.5 env: prod Proxy Frontend Pictures Proxy Pictures Proxy
  26. @BretMcG github.com/bretmcg Knative Serving defines principled objects Knative defines primitives

    with clear separation of concerns So far, we used Service, a lite version of Knative objects spec: container: image: gcr.io/knative-samples/simple-app:latest env: - name: SIMPLE_MSG value: "Hello Serverlessconf SF!" Service
  27. @BretMcG github.com/bretmcg Configuration Service Knative Serving defines principled objects Knative

    defines primitives with clear separation of concerns Configuration Current/desired state for your application Code & configuration (separated, ala 12 factor)
  28. @BretMcG github.com/bretmcg Revision Configuration Service Knative Serving defines principled objects

    Knative defines primitives with clear separation of concerns Configuration Current/desired state for your application Code & configuration (separated, ala 12 factor) Revision Point in time snapshots for your code and configuration
  29. @BretMcG github.com/bretmcg Knative Serving defines principled objects Revision Knative defines

    primitives with clear separation of concerns Configuration Current/desired state for your application Code & configuration (separated, ala 12 factor) Revision Point in time snapshots for your code and configuration Route Maps traffic to a revisions Supports fractional, named routing Route Configuration Service
  30. @BretMcG github.com/bretmcg Blue-green deployment model Route 100% Revision Configuration kind:

    Route ... spec: traffic: - revisionName: blue-green-00001 percent: 100
  31. @BretMcG github.com/bretmcg Blue-green deployment model kind: Route ... spec: traffic:

    - revisionName: blue-green-00001 percent: 100 - revisionName: blue-green-00002 percent: 0 name: v2 Deploy updated version of the service • Blue continues to take 100% of traffic • Named route (v2) to green version Revision Route 100% Revision 0% v2 Configuration Configuration
  32. @BretMcG github.com/bretmcg Blue-green deployment model Update service configuration • Send

    % of traffic to green • Still have explicit v2 route kind: Route ... spec: traffic: - revisionName: blue-green-00001 percent: 50 - revisionName: blue-green-00002 percent: 50 name: v2 Revision Route 98% Revision 2% (Experiment) Configuration Configuration Revision Route Revision Configuration Configuration
  33. @BretMcG github.com/bretmcg Blue-green deployment model Update service configuration • Incrementally

    add %, until all traffic is on green • Keep explicit named route to blue Secured with RBAC-based ACL kind: Route ... spec: traffic: - revisionName: blue-green-00001 percent: 0 name: v1 - revisionName: blue-green-00002 percent: 100 Revision Route 0% v1 Revision 100% Configuration Configuration Revision Route Revision Configuration Configuration
  34. @BretMcG github.com/bretmcg Blue-green deployment model Revision Route 0% v1 Revision

    100% Configuration Configuration Revision Route Revision Configuration Configuration Demo: Deploying and updating live service
  35. @BretMcG github.com/bretmcg More Knative pieces Knative Build enables source/git based

    deployments Knative Events compatible with CNCF standard Cloud Events Knative scales down when you don’t need it Knative scales up linearly with your load • Supports unpredictable usage pattern • 1-n when you app starts taking traffic
  36. @BretMcG github.com/bretmcg Knative auto-builds Supports GitOps or src-to-URL development patterns

    Why developers care? • No cross-compiling toil. • No need for Docker locally. • Cloud caching, faster image push. • Tooling ecosystem for Enterprise Policy to audit Builds. Loosely coupled • Use it to get started, and graduate to decoupled CI. • Keep your existing CI/CD to get started, and graduate to audited Builds.
  37. @BretMcG github.com/bretmcg Knative has opinions but is extensible Knative API

    • Event sources, event types • Buildpack build templates • Network configuration • Logging targets Some opinions may not be ideal for your use-case Kubernetes • Auto-scaling strategy • Function invokers • Message bus
  38. @BretMcG github.com/bretmcg GKE serverless add-on Available for all later this

    year Request early access today at g.co/serverlessaddon GKE serverless add-on
  39. @BretMcG github.com/bretmcg The goal is more serverless experiences for more

    developers. Even if it’s not perfectly serverless, happy devs will drive organizational change.
  40. @BretMcG github.com/bretmcg Resources cloud.google.com/serverless Knative github.com/knative slack.knative.dev GKE serverless add-on

    (sign-up) g.co/serverlessaddon Containers on Cloud Functions (sign-up) g.co/serverlesscontainers Thank you! Bret McGowen @BretMcG
  41. @BretMcG github.com/bretmcg Connect with me GitHub - github.com/bretmcg SlideShare -

    slideshare.net/bretmc My LinkTree - inktr.ee/bretmcg YouTube - youtube.com/c/BretMcG Speaker Deck - speakerdeck.com/bretmcg Sessionize - sessionize.com/bretmcg LinkedIn - linkedin.com/in/bretmcgowen Instagram - instagram.com/bret.mcgowen Thank you! Bret McGowen @BretMcG