KNative: Serverless computing on Kubernetes

KNative: Serverless computing on Kubernetes

Kubernetes excels at container scheduling, and offers useful primitives for automating infrastructure. But we’ve noticed that development teams often struggle when they use vanilla Kubernetes for application deployments. By all means, use Kubernetes to push containers all day long. But if you want to push application code — or a function — Kubernetes on its own isn’t enough.

Knative is an open source software layer that helps cloud service providers and enterprise platform operators deliver a serverless experience to developers on any cloud. It’s a way to abstract the operational overhead of deploying and managing workloads that run on K8s and provides a consistent approach so that developers can focus on writing cool code. It also gives build primitives that allows for creating pipelines for building and deploying on Kubernetes from Kubernetes.

In this talk we will learn what Knative is, why it was created and how you can get started.

Df80f3f6f29bdad0a439fa9eea7934be?s=128

Mofizur Rahman

July 30, 2019
Tweet

Transcript

  1. 9.

    @moficodes Agenda Learn About Knative and Why We Should Care

    See Some “Cool-ish” Demo Learn What’s to Come Next Be Impressed With Mofi
  2. 11.

    @moficodes Microservice Architecture • Products not Projects • Design for

    Failures • Organized Around Business Capabilities
  3. 15.

    @moficodes Kubernetes Features • Replicasets • Horizontal Auto Scaling •

    Health Check • Self Healing • Rolling Deployment • Rollback • Resource Quota • Service Discovery • Load Balancing • Networking • Cross Cloud • Secret Management • Batch Execution • Storage orchestration
  4. 18.

    @moficodes Serverless • Any platform that can do on demand

    work. • Run atomic (in theory) actions aka functions. • Scales according to need
  5. 19.

    @moficodes Current Solutions: Pros and Cons Pros • Good support

    and many choices • Can handle many types of events • Comparatively cheap Google Cloud Function, AWS Lambda, IBM Cloud Functions, Azure Functions etc. Cons • Not much control in terms of hardware • Can not really handle resource heavy work • Completely separate platform
  6. 21.

    @moficodes What is Knative? Extends Kubernetes to provide a set

    of middleware components that are essential to modern app development The following Knative components are currently available: • Build - Source-to-container build orchestration • Eventing - Management and delivery of events • Serving - Request-driven compute that can scale to zero
  7. 22.

    @moficodes Why Knative • Serverless capabilities on K8s • Extend

    K8s in a native way • Higher level primitives • More complete platform
  8. 23.

    @moficodes Serverless on K8s • Full compute power of a

    cluster “on demand” • Access to wide variety of hardware for serverless • All on the same platform
  9. 24.

    @moficodes Extend K8s in a Native Way • Make use

    of existing skills • Get to use standard tools • 3rd party tool support is better
  10. 25.

    @moficodes Higher Level Primitives • Combines bunch of K8s operations

    in higher level primitives • Enables automation
  11. 26.

    @moficodes Makes K8s More Complete With Knative K8s has •

    Serverless • Building • Event streams • Traffic Routing • Monitoring • Security (mTls) • Policy Enforcement • And all K8s things... Istio
  12. 30.

    @moficodes Serving • Uses Istio behind the scene • Used

    for intelligent routing, blue-green deployment • Scales to zero • Scale to limit
  13. 33.

    @moficodes Knative Build It's an open-source project that provides an

    implementation of the Build CRD that runs Builds on-cluster. It's not a complete standalone product that could be used for CI/CD. Think of it as a building block to facilitate the expression of Builds as part of larger systems.
  14. 34.

    @moficodes Key features of Knative Build • A Build can

    include multiple steps where each step specifies a Builder. • A Builder is a type of container image that you create to accomplish any task • The steps in a Build can push to a repository. • A BuildTemplate can be used to defined reusable templates. • The source in can be defined to mount data to a K8S Volume. Supports: Git, Cloud Storage, Container Image • Authenticate with ServiceAccount using Kubernetes Secrets.
  15. 36.

    @moficodes Blue/Green Deployment • Gradually shift traffic from one version

    to a newer version Also See Canary Deployment, A/B Testing
  16. 45.

    @moficodes Istio • Automatic load balancing for HTTP, gRPC, WebSocket,

    and TCP traffic. • Traffic management with routing rules, retries, failovers, and fault injection. • A pluggable policy layer, access controls, rate limits and quotas. • Automatic metrics, logs, and traces for all traffic. • Secure service-to-service communication (mTls) with authentication and authorization.
  17. 48.

    @moficodes Event Knative Eventing defines the following primitives: • Event

    Sources ◦ generate events from different sources (k8s, github, pub/sub, container) • Channels ◦ buffer between event producers and consumers • Subscriptions ◦ forward events from channels to services or other channels
  18. 49.

    @moficodes Eventing Principles 1. Services are loosely coupled 2. A

    producer can generate events before a consumer is listening, and a consumer can express an interest in an event or class of events that is not yet being produced. 3. Services can be connected to create new applications ◦ without modifying producer or consumer. ◦ with the ability to select a specific subset of events from a particular producer