Slide 1

Slide 1 text

Knative: Serverless Workload on Kubernetes Mofi Rahman

Slide 2

Slide 2 text

@moficodes Level Set

Slide 3

Slide 3 text

@moficodes Microservices?

Slide 4

Slide 4 text

@moficodes Containers?

Slide 5

Slide 5 text

@moficodes Container Orchestration?

Slide 6

Slide 6 text

@moficodes Kubernetes?

Slide 7

Slide 7 text

@moficodes Serverless?

Slide 8

Slide 8 text

Mofizur Rahman Developer Advocate, IBM Do Container Stuff, Collect Stickers, Write go code @moficodes

Slide 9

Slide 9 text

@moficodes Agenda Learn About Knative and Why We Should Care See Some “Cool-ish” Demo Learn What’s to Come Next Be Impressed With Mofi

Slide 10

Slide 10 text

@moficodes Microservice Architecture ● Modular Software Development ● Small Services ● Independently Deployable

Slide 11

Slide 11 text

@moficodes Microservice Architecture ● Products not Projects ● Design for Failures ● Organized Around Business Capabilities

Slide 12

Slide 12 text

@moficodes It’s not just breaking down application into smaller parts.

Slide 13

Slide 13 text

@moficodes That would make “Distributed Monolith”

Slide 14

Slide 14 text

@moficodes Microservices and Containerization ● Better resource utilization ● Portable solution ● Container orchestration

Slide 15

Slide 15 text

@moficodes Why Kubernetes?

Slide 16

Slide 16 text

@moficodes Kubernetes Features ● Replicasets ● Horizontal Auto Scaling ● Health Check ● Self Healing ● Rolling Deployment ● Rollback ● Resource Quota ● Service Discovery ● Load Balancing ● Networking ● Cross Cloud ● Secret Management ● Batch Execution ● Storage orchestration

Slide 17

Slide 17 text

@moficodes What is Serverless?

Slide 18

Slide 18 text

@moficodes Serverless ● Any platform that can do on demand work. ● Run atomic (in theory) actions aka functions. ● Scales according to need

Slide 19

Slide 19 text

@moficodes Current Solutions: Pros and Cons Pros ● Good support and many choices ● Can handle many types of events ● Comparatively cheap Google Cloud Function, AWS Lambda, IBM Cloud Functions, Azure Functions etc. Cons ● Not much control in terms of hardware ● Can not really handle resource heavy work ● Completely separate platform

Slide 20

Slide 20 text

@moficodes Knative Pronounced Kay-nay-tive ** Not Native or Ki-native **

Slide 21

Slide 21 text

@moficodes What is Knative? Extends Kubernetes to provide a set of middleware components that are essential to modern app development The following Knative components are currently available: ● Eventing - Management and delivery of events ● Serving - Request-driven compute that can scale to zero

Slide 22

Slide 22 text

@moficodes Why Knative ● Serverless capabilities on K8s ● Extend K8s in a native way ● Higher level primitives ● More complete platform

Slide 23

Slide 23 text

@moficodes Serverless on K8s ● Full compute power of a cluster “on demand” ● Access to wide variety of hardware for serverless ● All on the same platform

Slide 24

Slide 24 text

@moficodes Extend K8s in a Native Way ● Make use of existing skills ● Get to use standard tools ● 3rd party tool support is better

Slide 25

Slide 25 text

@moficodes Higher Level Primitives ● Combines bunch of K8s operations in higher level primitives ● Enables automation

Slide 26

Slide 26 text

@moficodes Makes K8s More Complete With Knative K8s has ● Serverless ● Event streams ● Traffic Routing ● Monitoring ● Security (mTls) ● Policy Enforcement ● And all K8s things... Istio

Slide 27

Slide 27 text

@moficodes

Slide 28

Slide 28 text

@moficodes

Slide 29

Slide 29 text

@moficodes

Slide 30

Slide 30 text

@moficodes Serving ● Uses Istio behind the scene ● Used for intelligent routing, blue-green deployment ● Scale down to zero ● Scale up to limit

Slide 31

Slide 31 text

@moficodes Demo

Slide 32

Slide 32 text

@moficodes

Slide 33

Slide 33 text

@moficodes Notes About Knative Build As of version v0.8 Knative build has been deprecated in favor of Tekton Pipeline

Slide 34

Slide 34 text

@moficodes Tekton Build Run on Kubernetes Have Kubernetes clusters as a first class type Use containers as their building blocks

Slide 35

Slide 35 text

@moficodes Tekton Primitives Task Defines a series of steps which launch specific build or delivery tools that ingest specific inputs and produce specific outputs. TaskRun Instantiates a Task for execution with specific inputs, outputs, and execution parameters. Can be invoked on its own or as part of a Pipeline. Pipeline Defines a series of Tasks that accomplish a specific build or delivery goal. Can be triggered by an event or invoked from a PipelineRun. PipelineResource Defines locations for inputs ingested and outputs produced by the steps in Tasks. PipelineRun Instantiates a Pipeline for execution with specific inputs, outputs, and execution parameters.

Slide 36

Slide 36 text

@moficodes Demo

Slide 37

Slide 37 text

@moficodes Blue/Green Deployment ● Gradually shift traffic from one version to a newer version Also See Canary Deployment, A/B Testing

Slide 38

Slide 38 text

@moficodes

Slide 39

Slide 39 text

@moficodes 100% V1

Slide 40

Slide 40 text

@moficodes 100% V1 0% V2

Slide 41

Slide 41 text

@moficodes 100% V1 0% V2

Slide 42

Slide 42 text

@moficodes 50% V1 50% V2

Slide 43

Slide 43 text

@moficodes 0% V1 100% V2

Slide 44

Slide 44 text

@moficodes

Slide 45

Slide 45 text

@moficodes Demo

Slide 46

Slide 46 text

@moficodes Event Knative Eventing defines the following primitives: ● Event Sources ○ generate events from different sources (k8s, github, pub/sub, container) ● Channels ○ buffer between event producers and consumers ● Subscriptions ○ forward events from channels to services or other channels

Slide 47

Slide 47 text

@moficodes Eventing Principles 1. Services are loosely coupled 2. A producer can generate events before a consumer is listening, and a consumer can express an interest in an event or class of events that is not yet being produced. 3. Services can be connected to create new applications ○ without modifying producer or consumer. ○ with the ability to select a specific subset of events from a particular producer

Slide 48

Slide 48 text

@moficodes

Slide 49

Slide 49 text

@moficodes Knative on IKS

Slide 50

Slide 50 text

@moficodes Learn More at developer.ibm.com/tutoials/knative-101-labs https://knative.dev

Slide 51

Slide 51 text

@moficodes Whats Next?

Slide 52

Slide 52 text

Mofizur Rahman Developer Advocate, IBM @moficodes

Slide 53

Slide 53 text

@moficodes Thank You