Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mofizur Rahman - Knative: Serverless Computing on Kubernetes

Mofizur Rahman - Knative: Serverless Computing on Kubernetes

DevOps Days GDL 2020 - February 20th

DevOpsDays GDL

February 21, 2020
Tweet

More Decks by DevOpsDays GDL

Other Decks in Technology

Transcript

  1. Knative: Serverless Workload on
    Kubernetes
    Mofi Rahman

    View Slide

  2. @moficodes
    Level Set

    View Slide

  3. @moficodes
    Microservices?

    View Slide

  4. @moficodes
    Containers?

    View Slide

  5. @moficodes
    Container Orchestration?

    View Slide

  6. @moficodes
    Kubernetes?

    View Slide

  7. @moficodes
    Serverless?

    View Slide

  8. Mofizur Rahman
    Developer Advocate, IBM
    Do Container Stuff, Collect Stickers, Write go code
    @moficodes

    View Slide

  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

    View Slide

  10. @moficodes
    Microservice Architecture
    ● Modular Software Development
    ● Small Services
    ● Independently Deployable

    View Slide

  11. @moficodes
    Microservice Architecture
    ● Products not Projects
    ● Design for Failures
    ● Organized Around Business Capabilities

    View Slide

  12. @moficodes
    It’s not just breaking
    down application into
    smaller parts.

    View Slide

  13. @moficodes
    That would make
    “Distributed Monolith”

    View Slide

  14. @moficodes
    Microservices and Containerization
    ● Better resource utilization
    ● Portable solution
    ● Container orchestration

    View Slide

  15. @moficodes
    Why
    Kubernetes?

    View Slide

  16. @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

    View Slide

  17. @moficodes
    What is Serverless?

    View Slide

  18. @moficodes
    Serverless
    ● Any platform that can do on demand work.
    ● Run atomic (in theory) actions aka functions.
    ● Scales according to need

    View Slide

  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

    View Slide

  20. @moficodes
    Knative
    Pronounced Kay-nay-tive
    ** Not Native or Ki-native **

    View Slide

  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:
    ● Eventing - Management and delivery of events
    ● Serving - Request-driven compute that can scale to zero

    View Slide

  22. @moficodes
    Why Knative
    ● Serverless capabilities on K8s
    ● Extend K8s in a native way
    ● Higher level primitives
    ● More complete platform

    View Slide

  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

    View Slide

  24. @moficodes
    Extend K8s in a Native Way
    ● Make use of existing skills
    ● Get to use standard tools
    ● 3rd party tool support is better

    View Slide

  25. @moficodes
    Higher Level Primitives
    ● Combines bunch of K8s operations in higher level primitives
    ● Enables automation

    View Slide

  26. @moficodes
    Makes K8s More Complete
    With Knative K8s has
    ● Serverless
    ● Event streams
    ● Traffic Routing
    ● Monitoring
    ● Security (mTls)
    ● Policy Enforcement
    ● And all K8s things...
    Istio

    View Slide

  27. @moficodes

    View Slide

  28. @moficodes

    View Slide

  29. @moficodes

    View Slide

  30. @moficodes
    Serving
    ● Uses Istio behind the scene
    ● Used for intelligent routing, blue-green deployment
    ● Scale down to zero
    ● Scale up to limit

    View Slide

  31. @moficodes
    Demo

    View Slide

  32. @moficodes

    View Slide

  33. @moficodes
    Notes About Knative Build
    As of version v0.8 Knative build has been deprecated in favor of Tekton Pipeline

    View Slide

  34. @moficodes
    Tekton Build
    Run on Kubernetes
    Have Kubernetes clusters as a first class type
    Use containers as their building blocks

    View Slide

  35. @moficodes
    Tekton Primitives
    Task Defines a series of steps which launch specific build or delivery tools that
    ingest specific inputs and produce specific outputs.
    TaskRun Instantiates a Task for execution with specific inputs, outputs, and execution
    parameters. Can be invoked on its own or as part of a Pipeline.
    Pipeline Defines a series of Tasks that accomplish a specific build or delivery goal.
    Can be triggered by an event or invoked from a PipelineRun.
    PipelineResource Defines locations for inputs ingested and outputs produced by the steps in
    Tasks.
    PipelineRun Instantiates a Pipeline for execution with specific inputs, outputs, and
    execution parameters.

    View Slide

  36. @moficodes
    Demo

    View Slide

  37. @moficodes
    Blue/Green Deployment
    ● Gradually shift traffic from one version to a newer version
    Also See Canary Deployment, A/B Testing

    View Slide

  38. @moficodes

    View Slide

  39. @moficodes
    100%
    V1

    View Slide

  40. @moficodes
    100%
    V1
    0% V2

    View Slide

  41. @moficodes
    100%
    V1
    0% V2

    View Slide

  42. @moficodes
    50%
    V1
    50%
    V2

    View Slide

  43. @moficodes
    0% V1
    100%
    V2

    View Slide

  44. @moficodes

    View Slide

  45. @moficodes
    Demo

    View Slide

  46. @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

    View Slide

  47. @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

    View Slide

  48. @moficodes

    View Slide

  49. @moficodes
    Knative on IKS

    View Slide

  50. @moficodes
    Learn More at
    developer.ibm.com/tutoials/knative-101-labs
    https://knative.dev

    View Slide

  51. @moficodes
    Whats Next?

    View Slide

  52. Mofizur Rahman
    Developer Advocate, IBM
    @moficodes

    View Slide

  53. @moficodes
    Thank You

    View Slide