47
Knative Serverless experience on Kubernetes Craig Box Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019

Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

  • Upload
    others

  • View
    37

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

KnativeServerless experience on Kubernetes

Craig BoxCloud Native Advocacy LeadGoogle Cloud

@craigbox

March 27, 2019

Page 2: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

*Sources: COCOMO Model, CNCF.io Certified Providers

442 Years of effort* 5,000+ Contributors 30k+ GitHub stars

The incredible Kubernetes ecosystem

Page 3: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Promise of serverless

No servers Idiomatic Event-driven Free of lock-in

Page 4: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Kubernetes de facto platform

Why Kubernetes?

● Abstracts infra management pain

● Wide CSP support enables portability

● Rich ecosystem of point-solutions

● Good operator experience

What about developer’s experience?

Page 5: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Developers just wanna write code

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

Page 6: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Introducing Knative

Kubernetes-based building blocks for serverless workloads

Page 7: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative partners

Page 8: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative new products

Page 9: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative analysis

Knative will almost certainly become the standard plumbing for functions as a service (FaaS) on Kubernetes

James Governor

RedMonk

Page 10: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

● Set of primitives (Build, Events, Serving)

● Solves for modern development patterns

● Implements learnings from Google, partners

● Ingredient or platform for OSS FaaS frameworks

github.com/knative

Introducing Knative (again)

Kubernetes-based building blocks for serverless workloads

Page 11: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

The Knative stack

KubernetesPlatform

Page 12: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

The Knative stack

Knative

Build Serving Events

KubernetesPlatform

Primitives

Page 13: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

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

Knative

Build Serving Events

Kubernetes

Page 14: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

The Knative stack

Knative building blocks

Build Serving Events

Page 15: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative build

Build

● Containers are the lingua franca

● Source to container orchestration

● In-cloud or on-cluster, plug in your own pipeline and builders

Page 16: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative serving

Serving

● Principled objects describe your app

● Automatic scaling, from zero to n

● Great on day one, ready for day two

Page 17: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative events

Events

● Powerful primitives for connecting event sources to consumers

● Rich ecosystem of local, public cloud or API-based event sources

● Reliable event delivery via popular messaging stacks

Page 18: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative Audience

Page 19: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative AudienceToday’s Session

Page 20: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative objects...and demos

Page 21: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative is easy to start with

● Specify only what’s necessary

● API familiar to existing Kubernetes users

● Easy to start, single command — it just works

DEMO: deploying pre-built image

Page 22: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative also grows with you to address more complex use-cases

Page 23: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

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 New Zealand!"

Service

Page 24: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative Serving defines principled objects

Knative defines primitives with clear separation of concerns

ConfigurationCurrent/desired state for your applicationCode & configuration (separated, ala 12 factor)

Configuration

Service

Page 25: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative Serving defines principled objects

Knative defines primitives with clear separation of concerns

ConfigurationCurrent/desired state for your applicationCode & configuration (separated, ala 12 factor)

RevisionPoint in time snapshots for your code and configuration

Revision

Configuration

Service

Page 26: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative Serving defines principled objects

Revision

Knative defines primitives with clear separation of concerns

ConfigurationCurrent/desired state for your applicationCode & configuration (separated, ala 12 factor)

RevisionPoint in time snapshots for your code and configuration

RouteMaps traffic to a revisionsSupports fractional, named routing

Route

Configuration

Service

Page 27: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative: good day one, even better days after

Page 28: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Demo: Deploying and updating live service

Blue-green deployment model

Route

100%

Revision

Configuration

kind: Route...spec:

traffic:

- revisionName: blue-green-00001

percent: 100

Page 29: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

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

RevisionRoute

100%

Revision

0%v2

Configuration

Configuration

Page 30: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

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

RevisionRoute

98%

Revision

2% (Experiment)

Configuration

Configuration

Page 31: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Blue-green deployment model

Update service configuration

● Incrementally add %, until all traffic is on green

● Keep explicit named route to blue with RBAC-based ACL

kind: Route...spec: traffic:

- revisionName: blue-green-00001

percent: 0

name: v1

- revisionName: blue-green-00002

percent: 100

RevisionRoute

0%v1

Revision

100%

Configuration

Configuration

Page 32: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative automates many common tasks

Page 33: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative auto-scales

Knative scales down when you don’t need it

● Developers don’t have to think about underlying infrastructure

Page 34: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative auto-scales

Knative scales up linearly with your load

● Supports unpredictable usage pattern

● 1-n when you app starts taking traffic

DEMO: Scaling to 0, 0-1, 1-n based on RPS

Page 35: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative auto-builds

Supports GitOps or src-to-URL development patterns

Demo: Deploy from git repo to user-accessible URL

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.

Page 36: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative is serverless, and serverless is more than just functions

Page 37: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Eventing constructs :

● Event Sources (producer)

● Event Types (different events)

● Event Actions (any route)

● Event Feeds (configuration)

Knative Eventing defines principled objects

Event type

Flow

Event sourceEvent type

Event type

Event consumer(s)

Page 38: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative Eventing defines principled objects

Topic

TopicSubscription

PubSub Topic

Topic

GoFunction

Same API, whether apps and functions

User-defined event sources

Decoupled event producers and consumers

CNCF CloudEvents support (now 0.2!)

Page 39: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

So how does Knative help developers?

Page 40: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Developers just wanna write code

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

Page 41: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative isextensible

Page 42: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Knative API

● Event sources, event types

● Buildpack build templates

● Network configuration

● Logging targets

Knative implements opinions

Some “opinions” may not be ideal for your use-case

Kubernetes

● Auto-scaling strategy

● Function invokers

● Message bus

Page 43: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

GKE serverless add-on

Page 44: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

GKE serverless add-on

1-step deploy

1-step install add-on on GKE

Deploy with less config/code

Run serverless workloads

Go from source to URL

Automatically deploys containers and

provision ingress

Auto-scale

Auto-scale your stateless container based workloads

Scale down to zero

Page 45: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Install, Samples, Docsgithub.com/knative/docs

Serverless on GKEg.co/serverlessaddon

Knative is ready for you

Want to contribute?knative/docs/community

Have questions?slack.knative.dev

Anything else? @KnativeProject@craigbox

Page 46: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The
Page 47: Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google Cloud @craigbox March 27, 2019 ... building blocks for serverless workloads. The

Thank you

Craig BoxCloud Native Advocacy LeadGoogle Cloud

@craigbox

March 27, 2019