Slide 1

Slide 1 text

@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

Slide 2

Slide 2 text

@BretMcG github.com/bretmcg Serverless swear words Contai***s Kubern****s Infrastr****re Offl*ne Cluster of virt*** mach***s .

Slide 3

Slide 3 text

@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

Slide 4

Slide 4 text

@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

Slide 5

Slide 5 text

@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

Slide 6

Slide 6 text

@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

Slide 7

Slide 7 text

@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

Slide 8

Slide 8 text

@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

Slide 9

Slide 9 text

@BretMcG github.com/bretmcg Cloud Functions as cloud glue Access 20+ Google services from GCF Cloud Storage Cloud Pub/Sub HTTPS Firebase Cloud Scheduler

Slide 10

Slide 10 text

@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

Slide 11

Slide 11 text

@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

Slide 12

Slide 12 text

@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

Slide 13

Slide 13 text

@BretMcG github.com/bretmcg First, a word about containers.... Containers != Kubernetes (I'm fired now)

Slide 14

Slide 14 text

@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

Slide 15

Slide 15 text

@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.

Slide 16

Slide 16 text

@BretMcG github.com/bretmcg Bad news friends... All major clouds run their functions as containers behind the scenes.

Slide 17

Slide 17 text

@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.

Slide 18

Slide 18 text

@BretMcG github.com/bretmcg Demo: containers aren’t scary

Slide 19

Slide 19 text

@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

Slide 20

Slide 20 text

@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)

Slide 21

Slide 21 text

@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

Slide 22

Slide 22 text

@BretMcG github.com/bretmcg Meet Knative: serverless on Kubernetes Kubernetes-based building blocks for serverless workloads Build - Serving - Events *kay-native

Slide 23

Slide 23 text

@BretMcG github.com/bretmcg Knative partners

Slide 24

Slide 24 text

@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

Slide 25

Slide 25 text

@BretMcG github.com/bretmcg The Knative stack Kubernetes + Istio Platform

Slide 26

Slide 26 text

@BretMcG github.com/bretmcg The Knative stack Knative Build Serving Events Kubernetes + Istio Platform Primitives

Slide 27

Slide 27 text

@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

Slide 28

Slide 28 text

@BretMcG github.com/bretmcg

Slide 29

Slide 29 text

@BretMcG github.com/bretmcg What is Kubernetes?

Slide 30

Slide 30 text

@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

Slide 31

Slide 31 text

@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

Slide 32

Slide 32 text

@BretMcG github.com/bretmcg Kubernetes abstracts away infrastructure Nodes Master

Slide 33

Slide 33 text

@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

Slide 34

Slide 34 text

@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

Slide 35

Slide 35 text

@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:

Slide 36

Slide 36 text

@BretMcG github.com/bretmcg Traffic control Observability Fault-injection Security Hybrid cloud Istio

Slide 37

Slide 37 text

@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

Slide 38

Slide 38 text

@BretMcG github.com/bretmcg Kubernetes provides a good operator experience. What about developer experience?

Slide 39

Slide 39 text

@BretMcG github.com/bretmcg Demo: deploy an app on Knative

Slide 40

Slide 40 text

@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

Slide 41

Slide 41 text

@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)

Slide 42

Slide 42 text

@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

Slide 43

Slide 43 text

@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

Slide 44

Slide 44 text

@BretMcG github.com/bretmcg Demo: Blue-green deployment

Slide 45

Slide 45 text

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

Slide 46

Slide 46 text

@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

Slide 47

Slide 47 text

@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

Slide 48

Slide 48 text

@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

Slide 49

Slide 49 text

@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

Slide 50

Slide 50 text

@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

Slide 51

Slide 51 text

@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.

Slide 52

Slide 52 text

@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

Slide 53

Slide 53 text

@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

Slide 54

Slide 54 text

@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.

Slide 55

Slide 55 text

@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

Slide 56

Slide 56 text

@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