Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google...

Post on 20-May-2020

37 views 0 download

Transcript of Google Cloud on Kubernetes Cloud Native Advocacy Lead ...€¦ · Cloud Native Advocacy Lead Google...

KnativeServerless experience on Kubernetes

Craig BoxCloud Native Advocacy LeadGoogle Cloud

@craigbox

March 27, 2019

*Sources: COCOMO Model, CNCF.io Certified Providers

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

The incredible Kubernetes ecosystem

Promise of serverless

No servers Idiomatic Event-driven Free of lock-in

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?

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

Introducing Knative

Kubernetes-based building blocks for serverless workloads

Knative partners

Knative new products

Knative analysis

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

James Governor

RedMonk

● 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

The Knative stack

KubernetesPlatform

The Knative stack

Knative

Build Serving Events

KubernetesPlatform

Primitives

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

The Knative stack

Knative building blocks

Build Serving Events

Knative build

Build

● Containers are the lingua franca

● Source to container orchestration

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

Knative serving

Serving

● Principled objects describe your app

● Automatic scaling, from zero to n

● Great on day one, ready for day two

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

Knative Audience

Knative AudienceToday’s Session

Knative objects...and demos

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

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

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

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

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

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

Knative: good day one, even better days after

Demo: Deploying and updating live service

Blue-green deployment model

Route

100%

Revision

Configuration

kind: Route...spec:

traffic:

- revisionName: blue-green-00001

percent: 100

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

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

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

Knative automates many common tasks

Knative auto-scales

Knative scales down when you don’t need it

● Developers don’t have to think about underlying infrastructure

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

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.

Knative is serverless, and serverless is more than just functions

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)

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

So how does Knative help developers?

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

Knative isextensible

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

GKE serverless add-on

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

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

Thank you

Craig BoxCloud Native Advocacy LeadGoogle Cloud

@craigbox

March 27, 2019