Slide 1

Slide 1 text

Build serverless application on top of Kubernetes
 ServerlessDays Melbourne 2019 @Melbourne Museum by toshi0607


Slide 2

Slide 2 text

About Me
 ● Toshinori Sugita
 ○ toshi0607
 ● Tokyo, Japan
 ● Software Engineer @Merpay, Mercari
 ○ developing payment service with Go, gPRC and GKE
 ● Active in Serveless Community (JP)
 ○ Serverless Meetup Tokyo, Serverless Days Tokyo
 ● OSS Contributor
 ○ Serverless Framework, aws-lambda-go/dotnet, Knative, KEDA
 ● Author
 ○ How to deal with Knative (ja), Learning AWS Lambda with Go (ja)


Slide 3

Slide 3 text

What I learned and lost in 3 weeks in Cairns
 ● lost my smartphone on the first day
 ● how to play beach volleyball
 ● blueness of the sky and the sea
 ● brownness of TimTam


Slide 4

Slide 4 text

Kubernetes
 Kubernetes (K8s) is an open-source system for automating deployment, scaling, and management of containerized applications.
 ※https://kubernetes.io/

Slide 5

Slide 5 text

Concept of Kubernetes
 ● apply desired state to your cluster defined in declarative manner
 ● controllers on K8s watch and keep desired state
 →reduce operational cost by auto recovery in trouble and auto scaling at high load
 ※https://kubernetes.io/docs/concepts/workloads/controllers/deployment/

Slide 6

Slide 6 text

How do we build a service with K8s?
 ● write code
 ● write Dockerfile
 ● build Docker image
 ● push image to registry
 ● deploy service
 ● expose service to internet
 ● set up monitoring
 ● set up autoscaling
 →We want to focus more on writing code!


Slide 7

Slide 7 text

Serverless
 ※https://github.com/cncf/wg-serverless/tree/master/whitepapers/serverless-overview Serverless computing refers to the concept of building and running applications that do not require server management. It describes a finer-grained deployment model where applications, bundled as one or more functions, are uploaded to a platform and then executed, scaled, and billed in response to the exact demand needed at the moment.


Slide 8

Slide 8 text

Serverless
 ※https://github.com/cncf/wg-serverless/tree/master/whitepapers/serverless-overview the idea that consumers of serverless computing no longer need to spend time and resources on server provisioning, maintenance, updates, scaling, and capacity planning. Instead, all of these tasks and capabilities are handled by a serverless platform and are completely abstracted away from the developers and IT/operations teams. 


Slide 9

Slide 9 text

Serverless
 ※https://github.com/cncf/wg-serverless/tree/master/whitepapers/serverless-overview As a result...
 ● Developers
 ○ can focus on writing their applications’ business logic. 
 ● Operations engineers
 ○ can elevate their focus to more business critical tasks.
 →We want to realize this situation on top of K8s


Slide 10

Slide 10 text

Serverless
 ※https://github.com/cncf/wg-serverless/tree/master/whitepapers/serverless-overview A serverless computing platform may provide one or both of the following:
 ● Function as a Service (FaaS)
 ● Backend as a Service (BaaS)
 →K8s itself is not FaaS or BaaS. How do we build serverless application on top of K8s?


Slide 11

Slide 11 text

Knative
 Kubernetes-based platform to build, deploy, and manage modern serverless workloads
 ※https://github.com/knative

Slide 12

Slide 12 text

Kubernetes and Sserverless
 ※https://github.com/knative/serving/blob/master/docs/spec/motivation.md Knative defines serverless workloads as computing workloads that are:
 ● Stateless
 ● Amenable to the process scale-out model
 ● Primarily driven by application level (L7 -- HTTP, for example) request traffic


Slide 13

Slide 13 text

Kubernetes and Sserverless
 ※https://github.com/knative/serving/blob/master/docs/spec/motivation.md ● K8s provides basic primitives like Deployment, and Service in support of the model
 →by standardizing on higher-level primitives which perform substantial amounts of automation of common infrastructure, it should be possible to build consistent toolkits that provide a richer experience than updating yaml files with kubectl.


Slide 14

Slide 14 text

What is Knative?
 ● Abstract K8s resources
 ○ make K8s resources simple for developers and operators
 ● Building blocks to build your own PaaS/FaaS
 ○ Serving, Eventing (and Build)
 ● Solving mundane but difficult tasks such as:
 ○ Deploying a container
 ○ Routing and managing traffic with blue/green deployment
 ○ Scaling automatically and sizing workloads based on demand
 ○ Binding running services to eventing ecosystems
 →build platform to focus more on business value for developers and operators
 ※https://github.com/knative/docs

Slide 15

Slide 15 text

Knative stack
 ※https://github.com/knative/docs/tree/master/docs Kubernetes
 Istio, Gloo or Ambassador
 Serving
 Build
 Eventing
 Platform
 Gateway
 Primitives


Slide 16

Slide 16 text

Serverless platform on K8s
 ※https://github.com/knative/docs/tree/master/docs Kubernetes
 Istio, Gloo or Ambassador 
 Serving
 Build
 Eventing
 Platform
 Gateway
 Primitives
 GitLab Serverless
 Your Own!
 Pivotal Function Service
 Cloud Run
 SAP Kyma
 Knative Lambda Runtimes
 Products


Slide 17

Slide 17 text

Build FaaS on top of K8s with Knative
 ● develop server to pass request to function because deploying artifacts are a container 
 ● decouple the server and function and include them into a single Dockerfile
 ● make CLI like faas-cli or tm to put K8s manifests and kubectl out of consciousness
 ● use cloudevents handler in your function


Slide 18

Slide 18 text

Difference from other FaaS on top of K8s
 ● Knative itself is not FaaS/PaaS. It provides the layer between K8s and serverless framework
 ● multiple vendors are developing together as OSS
 ● using cloudevents for event handling
 →We can avoid vendor lock in and easily migrate to other Knative based FaaS/PaaS


Slide 19

Slide 19 text

cloudevents
 ※https://cloudevents.io/

Slide 20

Slide 20 text

pros/cons of FaaS on K8s with Knative
 ● freedom of runtime
 ○ (+) Can utilize any language, binary, non vendor SDK
 ○ (−) Must prepare library by yourself
 ● standardize packaging format
 ○ (+) Don’t use different Zip for each FaaS, but Dockerfile
 ○ (−) Must learn how to write effective Dockerfile
 →More responsibility, but can make them templated in consistent manner


Slide 21

Slide 21 text

What is Cloud Run?
 Cloud Run is part of Google Cloud and it is a managed serverless platform that enables you to run stateless containers invocable via HTTP requests.
 ※https://cloud.google.com/run/

Slide 22

Slide 22 text

Serverless options in GCP
 ※https://cloud.google.com/serverless-options/

Slide 23

Slide 23 text

Summary
 ● Knative provides a solution to build severless platform on top of K8s
 ● Cloud Run provides a managed serveless container platform
 ● If you don’t operate K8s clusters, you can choose serverless service between CaaS and FaaS
 ● Knative and Cloud Run are not fully matured but have a great potential. I hope to make contributions


Slide 24

Slide 24 text

Reference (Knative)
 ● Docs
 ○ https://github.com/knative/docs
 ● Book
 ○ 『Getting Started with Knative』 free!
 ○ https://content.pivotal.io/ebooks/getting-started-with-knative
 ● Tutorial
 ○ https://github.com/meteatamel/knative-tutorial
 ● Slack
 ○ https://slack.knative.dev
 ● Twitter
 ○ https://mobile.twitter.com/KnativeProject


Slide 25

Slide 25 text

Thank you!
 Build servreless application on top of Kubernetes
 ServerlessDays Melbourne 2019 @Melbourne Museum by toshi0607