51
Serverless On Your Own Terms Using Knative Serverless at Google @mchmarny

Using Knative On Your Own Terms Serverless Serverless at

  • Upload
    others

  • View
    21

  • Download
    0

Embed Size (px)

Citation preview

Serverless at Google
Service-based Event-driven Open
Serverless with Portability
Scheduling
Upload image to registry
for serverless on Kubernetes
Nov
v0.2
Feb
v0.4
Jan 19
Apr
Knative Momentum
v0.7 v1beta1 API HPA-based scaling Non-root containers
July
Google Cloud Run on GKE IBM Cloud Kubernetes Service TriggerMesh
Build TektonServing
Pivotal Function Service IBM Cloud Functions Red Hat Cloud Functions
Pivotal riff OpenFaaS T-mobile Jazz
IstioService Mesh
Quick Start on GCP: bit.ly/cr-gke
Also available for: AKS Docker Gardener IKS Minikube OpenShift/Minishift PCS
Confidential & Proprietary
$: kubectl get cm -n knative-serving NAME DATA config-autoscaler 1 config-defaults 1 config-deployment 2 config-domain 1 config-gc 1 config-istio 1 config-logging 1 config-network 6 config-observability 1 config-tracing 1
Knative Features
Activates and scales based on request (up/down to 0 pods)
Manages code/config revisions (updates, rollbacks, traffic splits)
Integrates service mesh (request path/services access control)
Custom domains and SSL cert support
Knative Serving
Connect with other GCP services like Cloud Build and Stackdriver
Extend with partner integrations like GitLab and Datadog
Deployment
Result: service-name.namespace.domain.dev
# service.yaml apiVersion: serving.knative.dev/v1beta1 kind: Service metadata: name: service-name spec: template: spec: containers: - image: registry/image-name
Deployment
Other CLIs: knctl, os, ibmcloud
Autoscaling
GitOps using Cloud Build, GitLab, Jenkins (e.g. branch or release triggers) github.com/mchmarny/maxprime/blob/master/deployments/cloudbuild.yaml
Local Build uses Dockerfile, deploy using gcloud
docker build/tag/publish
On-cluster Build (Build Templates or github.com/tektoncd/pipeline)
kubectl apply -f build.yaml
ko apply -f config.yaml
Service Route - named endpoint and a mechanism for routing traffic
Revisions - immutable snapshots of code + config
Configuration - stream of environments for Revisions
Service - top-level wrapper for managing Route/Configurations sets
# List current revisions in demo namespace (filter on service name)
kubectl get revisions -n demo -l serving.knative.dev/service=maxprime
NAME SERVICE NAME GENERATION READY
maxprime-vq25k maxprime-vq25k-service 3 True
maxprime-wtz1g maxprime-wtz1g-service 2 True
maxprime-qtz5p maxprime-qtz5p-service 1 True
kubectl edit ksvc maxprime -n demo
Simple Revision Management
Internal Service • Backing Microservices • Eventing Targets
• Mobile backend • Webhook
Request Path Demo
Request Path
Plugable channel provisioners (e.g. PubSub. Kafka, NATS, In-Memory)
Benefits
Binds declaratively event sources, triggers, and services
Scales from just few events to live streaming pipelines
Uses standard CloudEvents (CNCF Project)
Name Description
Apache Camel Allows to use Apache Camel components for pushing events into Knative
Apache Kafka Brings Apache Kafka messages into Knative
AWS SQS Brings AWS Simple Queue Service messages into Knative
Cron Job Uses an in-memory timer to produce events on the specified Cron schedule.
GCP PubSub Brings GCP PubSub messages into Knative
GitHub Brings GitHub organization/repository events into Knative
GitLab Brings GitLab repository events into Knative.
Google Cloud Scheduler Google Cloud Scheduler events in Knative when jobs are triggered
Google Cloud Storage Brings Google Cloud Storage bucket/object events into Knative
Kubernetes Brings Kubernetes cluster/infrastructure events into Knative
Full lists: https://github.com/knative/docs/tree/master/docs/eventing/sources
Knative Event Sources
Simple Broker- 1-n per NS by default
- Discoverable endpoint
}
Simple Trigger- Uses CloudEvents
Knative Eventing Demo
Broker (default)
3. Send negative to Slack for review
4. Display positive tweets in UI
1 2 3 4
* Process IoT Core events (through PubSub)
* GCP PubSub (connector to many other GCP event sources)
* Actuate on Kubernetes events