The path to a
Serverless-native era with
Kubernetes
Who i am
Paolo Mainardi
@paolomainardi
➔
➔ CTO of Sparkfabrik
➔ CKA(D) certified, GCP Cloud Architect
➔ We are hiring!
What is Serverless
The session
● What is the hype
● Serverless concepts (FaaS, BaaS, *aaS)
● Serverless on Kubernetes
The hype
The hype
The hype
WHAT IS SERVERLESS ?
“Serverless computing refers to the concept of building and
running applications that do not require server management”
CNCF Serverless Whitepaper v1.0 - https://github.com/cncf/wg-serverless/tree/master/whitepapers/serverless-overview
SERVERLESS IS ALL
ABOUT THE
DEVELOPER EXPERIENCE
1. Cost and resource efficient — scale down to zero
2. Pay as you go — scale up on demand
3. Automation — of scale, failure handling, and recovery
4. Supporting the full dev cycle — dev, build, CI, prod
SERVERLESS IS ALL ABOUT THE DEVELOPER EXPERIENCE
Functions
What is Serverless
How we think about Serverless
FUNCTIONS EVENTS
A piece of code (usually written in
Javascript ) to perform a specific task.
A response to something that
happens in the cloud that triggers my
functions.
and
Functions
Use case #1
Credits: https://github.com/mhausenblas/2018-state-of-faas-on-kube
Translate a text file from
Italian to English*.
* only pay what you use
Functions
Use case #2
Credits: https://github.com/mhausenblas/2018-state-of-faas-on-kube
Process real-time data
and push notifications
to clients*
* only pay what you use
What is Serverless
Credits: https://www.gocd.org/2017/06/26/serverless-architecture-continuous-delivery/
Key properties of FaaS:
● Independent, server-side, logical functions
● Stateless, ephemeral
● Event-triggered
● Scalable from 0 to N
● Short-lived processes
● Fully managed by a third party (AWS Lambda, GCP Functions,
Azure Functions, Alibaba Cloud Function Compute…)
SERVERLESS ≠ FAAS
BAAS - Backend as a service
Credits: https://blog.neap.co/the-serverless-series-what-is-serverless-d651fbacf3f4
Credits: https://blog.neap.co/the-serverless-series-what-is-serverless-d651fbacf3f4
SERVERLESS
IS ALL ABOUT THE
BILLING MODEL
“A Serverless solution is one that costs you nothing
to run if nobody is using it (excluding data storage)”
“A simple definition of serverless,Paul Johnston, 2017”
What is Serverless
What is Serverless ?
What is Serverless
Serverless on public cloud
● Limited language runtimes supported (Lambda, GCP, Azure etc..)
● Vendor-proprietary mechanisms to package and deploy the functions
What is Serverless
Serverless on public cloud
● Proprietary Event format
● Locked-in language runtime
● Limited support to run or debug functions locally
LOCK-IN
Functions
Use case #3
Convert CSV files to
JSON
{JSON}
Functions
Use case #3
Convert CSV files to
JSON coming from
multiple cloud providers
{JSON}
Event format
Use case #3 - Event format
Functions
Use case #3
{JSON}
Functions
Use case #3
{JSON}
Functions
Use case #3
{JSON}
CloudEvents
CLOUDEVENTS IS A SPECIFICATION
FOR DESCRIBING EVENT
DATA IN A COMMON WAY
CloudEvents
CloudEvents
CloudEvents on public cloud
https://azure.microsoft.com/de-de/blog/announcing-first
-class-support-for-cloudevents-on-azure/
Contributors
https://github.com/cloudevents/spec/blo
b/master/community/contributors.md
Azure Event Grid
WHY
SERVERLESS ON KUBERNETES ?
Serverless & Kubernetes
Developing on Kubernetes is not easy
1. It’s not the right abstractions for end-developer
experience (eg: deployment, service, ingress, hpa,
monitoring)
2. But it’s a great platform to build a PaaS on top of
it: Primitives, Extensibility
Serverless & Kubernetes
Developer experience
Have to do Want to do
Write code
Serverless & Kubernetes
Developer experience
Have to do Want to do
Write code
Build docker image
Serverless & Kubernetes
Have to do Want to do
Write code
Build docker image
Push docker image to registry
Developer experience
Serverless & Kubernetes
Have to do Want to do
Write code
Build docker image
Push docker image to registry
Expose to internet
Developer experience
Serverless & Kubernetes
Have to do Want to do
Write code
Build docker image
Push docker image to registry
Expose to internet
Set-up monitoring
Developer experience
Serverless & Kubernetes
Have to do Want to do
Write code
Build docker image
Push docker image to registry
Expose to internet
Set-up monitoring
Set-up autoscaling
Developer experience
Serverless & Kubernetes
Have to do Want to do
Write code Write code
Build docker image
Push docker image to registry
Expose to internet
Set-up monitoring
Set-up autoscaling
Developer experience
BUILD A SERVERLESS
EXPERIENCE ON KUBERNETES
Knative
● Something to wake-up your workloads on request
● Something to scale-up and scale back to zero
● Something to turn your code into a container
● Something to collect metrics and export telemetry
● Traffic splitting and rollout strategies
● An eventing system with configurable sources and subscribers
DIY FaaS on Kubernetes
Knative
Kubernetes-based platform to build deploy and manage modern
serverless workloads.
Knative offers features like scale-to-zero, autoscaling and eventing
framework for cloud-native applications on Kubernetes.
https://knative.dev
KNATIVE
Knative
Knative collaborators
Knative
Knative building blocks
Knative
Knative building blocks
Knative
What is Knative
● A set of building blocks to construct your own Paas/FaaS
○ Abstracts common Kubernetes API objects (Build, Deploy,
Serve)
● An abstraction on top of Kubernetes
○ It’s still Kubernetes: It just run containers.
Knative
Knative serving
1. Scale-up and scale back to zero
2. Fine-grained traffic routing
3. Automatic metrics and telemetry
4. Point-in-time snapshot (revisions)
Knative
Knative eventing
1. A complete eventing system
for event-driven apps.
2. Easy for developers to
consume events
(CloudEvents spec)
3. Pluggable, Customizable
Event Sources.
Knative
Knative build
Knative
Knative build
“Deprecating Knative Build would resolve this confusion as it would make it clear that the
"building the service(s) image" part is not Knative's responsability and user can use whatever
tools is capable of doing that — preferably Tekton Pipelines 👼.”
Knative
Tektonik pipeline
1. The Tekton Pipelines project provides Kubernetes-style resources for
declaring CI/CD-style pipelines
2. Builds are ran completely within Kubernetes (no need of Docker)
3. Build Templates are prepackaged descriptions of different ways to
build code (Kaniko, Buildpacks and more)
Knative
Knative-based platforms
Knative
● As a developer: Use it directly to deploy your stuff in a more
streamlined way than raw Kubernetes.
What you can do with Knative
Knative
● As a developer: Use it directly to deploy your stuff in a more
streamlined way than raw Kubernetes.
● As an operator: Put a level of abstractions between Kubernetes
and your devs; Keep the costs under control by scaling to 0
unused workloads.
What you can do with Knative
Knative
● As a developer: Use it directly to deploy your stuff in a more
streamlined way than raw Kubernetes.
● As an operator: Put a level of abstractions between Kubernetes
and your devs; Keep the costs under control by scaling to 0
unused workloads.
● As a platform architect: Build your own PaaS/FaaS platform,
relying on the Knative primitives.
What you can do with Knative
KNATIVE-NATIVE
PLATFORMS
Knative - Pivotal Riff
Pivotal Riff
1. Open source project from Pivotal Vmware
2. Deep Kubernetes integration using CRDs
3. Pluggable application runtimes [Core, Knative...]
4. A custom builder based on buildpacks.io (source to container)
5. A custom cli tool “riff” to manage the entire lifecycle
Knative - Google Cloud Run
Google CloudRun
1. Fully GCP managed beta
Serverless platform based on
Knative
2. Event-driven architecture (HTTP +
Pub/Sub)
3. Cloud Run on GKE + Anthos (aka:
GKE-on prem)
4. A sort of managed Knative + Istio
Credits: https://twitter.com/ahmetb/status/1116041166359654400
Knative - Openshift serverless
Openshift Serverless
1. OpenShift Serverless is a Technology Preview feature only (not yet
supported)
2. Based on Knative Serving + Eventing + Tekton pipeline
3. Can be integrated with other OpenShift services, such as Pipelines,
Service Mesh, Monitoring and Metering
BREAKING NEWS!
BREAKING NEWS
https://www.theregister.co.uk/2019/10/02/google_knative_will_not_be_donated_to_any_foundation/
BREAKING NEWS
KUBERNETES-NATIVE
PLATFORMS
Kubernetes-native serverless platforms
➔ Open source platforms
➔ Flexible language runtimes
➔ Custom CLIs
➔ Written in GO (OpenWhisk in
Scala)
➔ Backed by big vendors (Oracle,
IBM, Vmware)
Kubernetes open-source serverless platforms
CNCF Serverless landscape
Serverless & Kubernetes
Serverless on Kubernetes:
Serverless & Kubernetes
Serverless on Kubernetes:
● Container based language runtimes
● Container based language runtimes
● Multi/hybrid cloud and on your laptop
Serverless & Kubernetes
Serverless on Kubernetes:
Serverless & Kubernetes
Serverless on Kubernetes:
● Container based language runtimes
● Multi/hybrid cloud and on your laptop
● Mix and match stateless and stateful workloads
Serverless & Kubernetes
Serverless on Kubernetes:
● Container based language runtimes
● Multi/hybrid cloud and on your laptop
● Mix and match stateless and stateful workloads
● Kubernetes as the operating system for cloud-native
development
Serverless & Kubernetes
In the cloud platforms, Serverless & k8s will essentially converge:
“Kubernetes, just run my code”
GRAZIE

The path to a serverless-native era with Kubernetes