SlideShare a Scribd company logo
Serverless with Knative
Mete Atamel
Developer Advocate at Google
@meteatamel
github.com/meteatamel/knative-tutorial
Confidential & Proprietary
bit.ly/knative-survey
Introduction to Knative
Confidential & Proprietary
What is Knative?
Kubernetes based
open source building
blocks for serverless
Confidential & Proprietary
Ideal Serverless
No servers Idiomatic Event-driven Portable
Confidential & Proprietary
Kubernetes
Service
Pods
Each pod containers
one or more containers
Nodes
Role: frontend
Role: frontend Role: frontend Role: frontend
Replication
controller
Replicas: 3
Env: prod
microservice
labels
Service
communication
channel
Blueprint
“pod
template”
Env: prod Env: prod Env: prod registry
containers
Confidential & Proprietary
Developers want serverless
... just want to run their code.
... want to use their favorite
languages and dependencies.
... don't want to manage the
infrastructure.
Operators want Kubernetes
Kubernetes is great orchestrating
microservices
They love using GKE and not having to
do operations for Kubernetes.
Kubernetes is not the right abstraction
for their developers.
Confidential & Proprietary
Knative Project - github.com/knative
Set of components (serving, eventing, build)
Ingredients for Serverless
Solves for modern development patterns
Implements learnings from Google, partners
Knative stack
Build Serving
KubernetesPlatform
Products
Primitives Events ...
Serverless Containers on GCF GKE Serverless Add-on SAP Kyma
Pivotal Function Service IBM Cloud Functions Red Hat Cloud Functions
Pivotal riff OpenFaaS T-mobile Jazz
IstioService Mesh
Confidential & Proprietary
Knative Stack
Build Serving
KubernetesPlatform
Products
Primitives Events ...
Serverless Containers on GCF GKE Serverless Add-on SAP Kyma
Pivotal Function Service IBM Cloud Functions Red Hat Cloud Functions
Pivotal riff OpenFaaS T-mobile Jazz
IstioService Mesh
# Get a Kubernetes Cluster
$ gcloud container clusters create hello-knative
--cluster-version=latest
--num-nodes=3
--zone europe-west1-b
--scopes=service-control,service-management,compute-rw,storage-ro,cloud-platform,l
ogging-write,monitoring-write,pubsub,datastore
Creating cluster hello-knative...done.
NAME LOCATION MASTER_VERSION MASTER_IP MACHINE_TYPE NODE_VERSION NUM_NODES STATUS
Hello-knative europe-west1-b 1.10.7-gke.6 35.190.192.251 n1-standard-1 1.10.7-gke.6 4 RUNNING
# Create Cluster Role Binding
$ kubectl create clusterrolebinding cluster-admin-binding 
--clusterrole=cluster-admin 
--user=$(gcloud config get-value core/account)
clusterrolebinding "cluster-admin-binding" created
Confidential & Proprietary
Knative Stack
Build Serving
KubernetesPlatform
Products
Primitives Events ...
Serverless Containers on GCF GKE Serverless Add-on SAP Kyma
Pivotal Function Service IBM Cloud Functions Red Hat Cloud Functions
Pivotal riff OpenFaaS T-mobile Jazz
IstioService Mesh
# Install Istio
$ kubectl apply
-f https://github.com/knative/serving/releases/download/v0.3.0/istio-crds.yaml && 
kubectl apply
-f https://github.com/knative/serving/releases/download/v0.3.0/istio.yaml
# Install Knative Serving, Build, Eventing
$ kubectl apply
-f https://github.com/knative/serving/releases/download/v0.3.0/serving.yaml 
-f https://github.com/knative/build/releases/download/v0.3.0/release.yaml 
-f https://github.com/knative/eventing/releases/download/v0.3.0/release.yaml 
-f https://github.com/knative/eventing-sources/releases/download/v0.3.0/release.yaml 
-f https://github.com/knative/serving/releases/download/v0.3.0/monitoring.yaml
Knative Serving
Confidential & Proprietary
Knative Serving
What is it?
Rapid deployment and autoscaling
of serverless containers.
Seamlessly scale up and down
Built-in traffic splitting between
revisions
Integrates networking and service
mesh automatically
Pluggable
Connect to your own logging
and monitoring platform, or use
the built-in system
Auto-scaler can be tuned or
swapped out for custom code
Confidential & Proprietary
Knative Serving Primitives
Knative Service
High level abstraction for the application
Configuration
Current/desired state of an application
Code & configuration separated (a la 12-factor)
Revision
Point in time snapshots for your code and configuration
Route
Maps traffic to revisions
Knative Eventing
Confidential & Proprietary
Knative Eventing
What is it?
For loosely coupled, event-driven
services
Declaratively bind between event
producers and Knative services
Scales from just few events to live
streams
Custom event pipelines to connect
with your own existing systems
Event type
Flow
Event
source
Event type
Event type
Event
consumer(s)
KubernetesEventSource
GitHubSource
GcpPubSubSource
AwsSqsSource
ContainerSource
CronJobSource
Confidential & Proprietary
Knative Eventing
Confidential & Proprietary
Integrate Cloud Storage to Vision API
Cloud Storage
Bucket
Cloud Storage -> Cloud PubSub -> Knative Eventing -> Knative Servicing -> Vision API
Cloud PubSub
Topic
Knative Eventing
Channel
Knative Serving
GKE
Cloud Vision API
Labels
Knative Build
Confidential & Proprietary
Knative Build
What is it?
Go from source code to container
images on repositories
Build pipelines can have multiple
steps and can push to different
registries
Builds run in containers in the
cluster. No need for Docker locally
Primitives
Build: Represents an in-cluster
build job with 1 or more steps
BuildTemplate: A set of ordered
and parameterized build steps.
Builder: A container in a Build
step that performs an action
(eg. build)
ServiceAccount: For
authentication with DockerHub
etc.
Confidential & Proprietary
Thank you!
@meteatamel
github.com/meteatamel/knative-tutorial
github.com/knative
cloud.google.com/knative

More Related Content

Mete Atamel - Serverless with Knative - Codemotion Amsterdam 2019

  • 1. Serverless with Knative Mete Atamel Developer Advocate at Google @meteatamel github.com/meteatamel/knative-tutorial
  • 4. Confidential & Proprietary What is Knative? Kubernetes based open source building blocks for serverless
  • 5. Confidential & Proprietary Ideal Serverless No servers Idiomatic Event-driven Portable
  • 6. Confidential & Proprietary Kubernetes Service Pods Each pod containers one or more containers Nodes Role: frontend Role: frontend Role: frontend Role: frontend Replication controller Replicas: 3 Env: prod microservice labels Service communication channel Blueprint “pod template” Env: prod Env: prod Env: prod registry containers
  • 7. Confidential & Proprietary Developers want serverless ... just want to run their code. ... want to use their favorite languages and dependencies. ... don't want to manage the infrastructure. Operators want Kubernetes Kubernetes is great orchestrating microservices They love using GKE and not having to do operations for Kubernetes. Kubernetes is not the right abstraction for their developers.
  • 8. Confidential & Proprietary Knative Project - github.com/knative Set of components (serving, eventing, build) Ingredients for Serverless Solves for modern development patterns Implements learnings from Google, partners
  • 9. Knative stack Build Serving KubernetesPlatform Products Primitives Events ... Serverless Containers on GCF GKE Serverless Add-on SAP Kyma Pivotal Function Service IBM Cloud Functions Red Hat Cloud Functions Pivotal riff OpenFaaS T-mobile Jazz IstioService Mesh
  • 10. Confidential & Proprietary Knative Stack Build Serving KubernetesPlatform Products Primitives Events ... Serverless Containers on GCF GKE Serverless Add-on SAP Kyma Pivotal Function Service IBM Cloud Functions Red Hat Cloud Functions Pivotal riff OpenFaaS T-mobile Jazz IstioService Mesh # Get a Kubernetes Cluster $ gcloud container clusters create hello-knative --cluster-version=latest --num-nodes=3 --zone europe-west1-b --scopes=service-control,service-management,compute-rw,storage-ro,cloud-platform,l ogging-write,monitoring-write,pubsub,datastore Creating cluster hello-knative...done. NAME LOCATION MASTER_VERSION MASTER_IP MACHINE_TYPE NODE_VERSION NUM_NODES STATUS Hello-knative europe-west1-b 1.10.7-gke.6 35.190.192.251 n1-standard-1 1.10.7-gke.6 4 RUNNING # Create Cluster Role Binding $ kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --user=$(gcloud config get-value core/account) clusterrolebinding "cluster-admin-binding" created
  • 11. Confidential & Proprietary Knative Stack Build Serving KubernetesPlatform Products Primitives Events ... Serverless Containers on GCF GKE Serverless Add-on SAP Kyma Pivotal Function Service IBM Cloud Functions Red Hat Cloud Functions Pivotal riff OpenFaaS T-mobile Jazz IstioService Mesh # Install Istio $ kubectl apply -f https://github.com/knative/serving/releases/download/v0.3.0/istio-crds.yaml && kubectl apply -f https://github.com/knative/serving/releases/download/v0.3.0/istio.yaml # Install Knative Serving, Build, Eventing $ kubectl apply -f https://github.com/knative/serving/releases/download/v0.3.0/serving.yaml -f https://github.com/knative/build/releases/download/v0.3.0/release.yaml -f https://github.com/knative/eventing/releases/download/v0.3.0/release.yaml -f https://github.com/knative/eventing-sources/releases/download/v0.3.0/release.yaml -f https://github.com/knative/serving/releases/download/v0.3.0/monitoring.yaml
  • 13. Confidential & Proprietary Knative Serving What is it? Rapid deployment and autoscaling of serverless containers. Seamlessly scale up and down Built-in traffic splitting between revisions Integrates networking and service mesh automatically Pluggable Connect to your own logging and monitoring platform, or use the built-in system Auto-scaler can be tuned or swapped out for custom code
  • 14. Confidential & Proprietary Knative Serving Primitives Knative Service High level abstraction for the application Configuration Current/desired state of an application Code & configuration separated (a la 12-factor) Revision Point in time snapshots for your code and configuration Route Maps traffic to revisions
  • 16. Confidential & Proprietary Knative Eventing What is it? For loosely coupled, event-driven services Declaratively bind between event producers and Knative services Scales from just few events to live streams Custom event pipelines to connect with your own existing systems Event type Flow Event source Event type Event type Event consumer(s) KubernetesEventSource GitHubSource GcpPubSubSource AwsSqsSource ContainerSource CronJobSource
  • 18. Confidential & Proprietary Integrate Cloud Storage to Vision API Cloud Storage Bucket Cloud Storage -> Cloud PubSub -> Knative Eventing -> Knative Servicing -> Vision API Cloud PubSub Topic Knative Eventing Channel Knative Serving GKE Cloud Vision API Labels
  • 20. Confidential & Proprietary Knative Build What is it? Go from source code to container images on repositories Build pipelines can have multiple steps and can push to different registries Builds run in containers in the cluster. No need for Docker locally Primitives Build: Represents an in-cluster build job with 1 or more steps BuildTemplate: A set of ordered and parameterized build steps. Builder: A container in a Build step that performs an action (eg. build) ServiceAccount: For authentication with DockerHub etc.
  • 21. Confidential & Proprietary Thank you! @meteatamel github.com/meteatamel/knative-tutorial github.com/knative cloud.google.com/knative