Slide 1

Slide 1 text

Mauricio ‘Salaboy’ Salatino Dave Protasowski Luke Kingland Knative Functions: Deep Dive

Slide 2

Slide 2 text

salaboy salaboy Functions Lead & Steering OSS Engineer Mauricio Salatino salaboy

Slide 3

Slide 3 text

dprotaso lintinmybelly Serving Lead & TOC Staff Engineer Dave Protasowski dprotasowski

Slide 4

Slide 4 text

lkingland lukekingland Functions Lead Principal Engineer Luke Kingland lukekingland

Slide 5

Slide 5 text

Agenda ● Knative Overview ● Quick Project Updates ● Functions Overview ● Functions Demo ● f(Knative Serving)=❤

Slide 6

Slide 6 text

Knative Overview ● Kubernetes based open source building blocks for serverless ● Founded - 2018 ● CNCF Incubating - 2022 ● knative.dev

Slide 7

Slide 7 text

Knative ● Serving ○ Autoscales your workloads based on traffic - can scale to zero ● Eventing ○ Declaratively bind consumers and producers of events ● Client (kn) ○ Create resources interactively from the command line ● Functions ○ A programming model to simplify development

Slide 8

Slide 8 text

Knative Project Updates ● User Experience WG ○ Sourcing People for User Interviews! ■ Sign up @ https://bit.ly/knative-user-interview

Slide 9

Slide 9 text

Knative Project Updates ● UX - New Mascot Kuack!

Slide 10

Slide 10 text

Knative Project Updates ● Client WG ○ Held a 48 Hour Hackathon with Prizes ○ Check out the Wrap Up Presentation

Slide 11

Slide 11 text

Knative Project Updates ● Eventing WG ○ Eventing transport encryption (Eventing TLS) ○ Improved Event Discovery ○ Event Catalog with Backstage ○ net-eventing-rabbitmq will be picked up by the RabbitMQ Team

Slide 12

Slide 12 text

Knative Project Updates ● Security WG ○ Security Audit Completed (blog)

Slide 13

Slide 13 text

Knative Project Updates ● Steering Updates ○ Proposal for Graduation https://github.com/cncf/toc/pull/1245

Slide 14

Slide 14 text

Functions Overview ● Demo: https://github.com/salaboy/knative-kubecon-eu-2024/

Slide 15

Slide 15 text

Functions Demo ● Keypoints ○ Function lifecycle (instance based functions) ○ Non-opinionated function runtime ○ Host builder ○ Build and Deploy independently

Slide 16

Slide 16 text

Serving + Functions ● Higher Level Abstraction than Kubernetes ● Container ⇒ URL ● Autoscales your workloads based on traffic ○ Scales to Zero ● Automatic Certificate Provisioning for HTTPS ● Revision Management & Traffic Splitting ● Automatic Health Checks

Slide 17

Slide 17 text

Serving + Functions ● Higher Level Abstraction than Kubernetes ● Container ⇒ URL apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: my-func apiVersion: apps/v1 kind: Deployment metadata: name: my-func spec: selector: matchLabels: app: my-func replicas: 2 template: metadata: labels: app: my-func spec: containers: - name: my-func image: my-func:2.0 ports: - containerPort: 80 https://my-func.default.example.com apiVersion: v1 kind: Service metadata: name: my-func spec: selector: app: my-func ports: - port: 80 protocol: TCP targetPort: 80 apiVersion: v1 kind: Ingress metadata: name: my-func spec: rules: - http: my-func paths: - path: / backend: serviceName: my-func servicePort: 80 apiVersion: v1 kind: Service metadata: name: my-func spec: selector: app: my-func ports: - port: 80 protocol: TCP targetPort: 80 apiVersion: serving.knative.dev/v1 kind: Service metadata: name: my-func spec: template: spec: containers: - image: my-func:2.0 ports: - containerPort: 80

Slide 18

Slide 18 text

Serving + Functions ● Autoscales your workloads based on traffic apiVersion: serving.knative.dev/v1 kind: Service metadata: name: nginx spec: template: spec: containerConcurrency: 1 containers: - image: nginx:1.14.2 ports: - containerPort: 80 Concurrency Number of simultaneous requests that can be processed by each replica of an application at any given time.

Slide 19

Slide 19 text

Serving + Functions Pod my-func Pod my-func Pod my-func 3 requests concurrency = 1 concurrency = 80 Pod my-func 3 requests

Slide 20

Slide 20 text

Serving + Functions concurrency = 1 concurrency = 80 Source: https://cloud.google.com/run/docs/about-concurrency

Slide 21

Slide 21 text

Serving + Functions ● Concurrency ○ Using low values ~1 ■ More instances spin up ■ Can hit K8s limits faster (eg. max # pods on a node) ○ Using >1 ■ Requires more Memory & CPU ■ Can’t use Global State ○ Tune the value to your function

Slide 22

Slide 22 text

● Scale to Zero Ingress Pod my-func Serving + Functions

Slide 23

Slide 23 text

● Scale to Zero Ingress Serving + Functions Activator

Slide 24

Slide 24 text

● Scale to Zero Activator Ingress Serving + Functions

Slide 25

Slide 25 text

● Scale to Zero Activator Ingress Serving + Functions

Slide 26

Slide 26 text

● Scale to Zero Activator Ingress Serving + Functions Pod my-func

Slide 27

Slide 27 text

● Scale to Zero Activator Ingress Serving + Functions Pod my-func

Slide 28

Slide 28 text

● Scale to Zero Ingress Serving + Functions Pod my-func

Slide 29

Slide 29 text

● Burst Capacity Ingress Serving + Functions Pod my-func https://knative.dev/docs/serving/load-balancing/target-burst-capacity

Slide 30

Slide 30 text

● Burst Capacity Ingress Serving + Functions Pod my-func Activator https://knative.dev/docs/serving/load-balancing/target-burst-capacity

Slide 31

Slide 31 text

● Burst Capacity Ingress Serving + Functions Pod my-func Activator https://knative.dev/docs/serving/load-balancing/target-burst-capacity Pod my-func Pod my-func Pod my-func

Slide 32

Slide 32 text

● Burst Capacity ○ Configured via annotation on the Revision Ingress Serving + Functions Pod my-func Activator https://knative.dev/docs/serving/load-balancing/target-burst-capacity Pod my-func Pod my-func Pod my-func autoscaling.knative.dev/target-burst-capacity: "200"

Slide 33

Slide 33 text

● Burst Capacity https://knative.dev/blog/articles/demystifying-activator-on-path/ Serving + Functions https://knative.dev/docs/serving/load-balancing/target-burst-capacity

Slide 34

Slide 34 text

Q&A - Thanks! Scan the QR Code Leave Feedback!