@moficodes
The What, Why and How of
Knative
Mofizur Rahman & Sai Vennam
@moficodes
Microservices
Microservices are a software development technique—a variant of the service-oriented
architecture (SOA) architectural style that structures an application as a collection of
loosely coupled services. In a microservices architecture, services are fine-grained and the
protocols are lightweight. The benefit of decomposing an application into different smaller
services is that it improves modularity. This makes the application easier to understand,
develop, test, and become more resilient to architecture erosion. It parallelizes
development by enabling small autonomous teams to develop, deploy and scale their
respective services independently.It also allows the architecture of an individual service to
emerge through continuous refactoring.Microservices-based architectures enable
continuous delivery and deployment.
Source: wikipedia
@moficodes
Microservice Architecture
● Modular Software Development
● Small Services
● Independently Deployable
@moficodes
Microservice Architecture
● Products not Projects
● Design for Failures
● Organized Around Business Capabilities
@moficodes
Microservices and Containerization
● Better resource utilization
● Portable solution
● Container orchestration
@moficodes
Kubernetes
Kubernetes is a portable, extensible open-source platform for
managing containerized workloads and services, that facilitates
both declarative configuration and automation. It has a large,
rapidly growing ecosystem. Kubernetes services, support, and
tools are widely available.
Source: kubernetes.io docs
@moficodes
Why Kubernetes
@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
With 3rd party tools
● Monitoring
● Traffic Management
● Telemetry
● Security and policy enforcement
● Graphs and Dashboards
@moficodes
Serverless
● Any platform that can do on demand work.
● Run atomic (in theory) actions aka functions.
● Scales according to need
@moficodes
Knative
Pronounced Kay-nay-tive
**Not Native or Ki-native**
@moficodes
What is Knative?
Extends Kubernetes to provide a set of middleware components that are essential to
build modern, source-centric, and container-based applications that can run anywhere:
on premises, in the cloud, or even in a third-party data center.
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
@moficodes
Install Knative
@moficodes
@moficodes
Serving
● User Istio behind the scene
● Used for intelligent routing, blue-green deployment
● Scales to zero
@moficodes
@moficodes
Demo
@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.
@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,
whether that's a single step in a process, or the whole process itself.
● The steps in a Build can push to a repository.
● A BuildTemplate can be used to defined reusable templates.
● The source in a Build can be defined to mount data to a Kubernetes Volume, and
supports:
○ git repositories
○ Cloud Storage
○ An arbitrary container image
● Authenticate with ServiceAccount using Kubernetes Secrets.
@moficodes
Demo
@moficodes
A/B Testing
● Gradually shift traffic from one version to a newer version
@moficodes
@moficodes
@moficodes
Istio
● Automatic load balancing for HTTP, gRPC, WebSocket, and TCP traffic.
● Fine-grained control of traffic behavior with rich routing rules, retries, failovers,
and fault injection.
● A pluggable policy layer and configuration API supporting access controls, rate
limits and quotas.
● Automatic metrics, logs, and traces for all traffic within a cluster, including cluster
ingress and egress.
● Secure service-to-service communication in a cluster with strong identity-based
authentication and authorization.
@moficodes
@moficodes
Demo
@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
@moficodes
Eventing Principles
1. Services are loosely coupled during development and deployed independently on
a variety of platforms (Kubernetes, VMs, SaaS or FaaS).
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
@moficodes
@moficodes
IBM Open Source
● Istio
● Knative
● Nodejs
● Hyperledger
● Cloudfoundry
● OpenJ9
● Mircroprofile
...And so many more
@moficodes
Knative on IKS
@moficodes
Learn More at
developer.ibm.com/tutoials/knative-101-labs
https://github.com/knative/docs
@moficodes
Thank You

The what, why and how of knative

  • 1.
    @moficodes The What, Whyand How of Knative Mofizur Rahman & Sai Vennam
  • 2.
    @moficodes Microservices Microservices are asoftware development technique—a variant of the service-oriented architecture (SOA) architectural style that structures an application as a collection of loosely coupled services. In a microservices architecture, services are fine-grained and the protocols are lightweight. The benefit of decomposing an application into different smaller services is that it improves modularity. This makes the application easier to understand, develop, test, and become more resilient to architecture erosion. It parallelizes development by enabling small autonomous teams to develop, deploy and scale their respective services independently.It also allows the architecture of an individual service to emerge through continuous refactoring.Microservices-based architectures enable continuous delivery and deployment. Source: wikipedia
  • 3.
    @moficodes Microservice Architecture ● ModularSoftware Development ● Small Services ● Independently Deployable
  • 4.
    @moficodes Microservice Architecture ● Productsnot Projects ● Design for Failures ● Organized Around Business Capabilities
  • 5.
    @moficodes Microservices and Containerization ●Better resource utilization ● Portable solution ● Container orchestration
  • 6.
    @moficodes Kubernetes Kubernetes is aportable, extensible open-source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available. Source: kubernetes.io docs
  • 7.
  • 8.
    @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 With 3rd party tools ● Monitoring ● Traffic Management ● Telemetry ● Security and policy enforcement ● Graphs and Dashboards
  • 9.
    @moficodes Serverless ● Any platformthat can do on demand work. ● Run atomic (in theory) actions aka functions. ● Scales according to need
  • 10.
  • 11.
    @moficodes What is Knative? ExtendsKubernetes to provide a set of middleware components that are essential to build modern, source-centric, and container-based applications that can run anywhere: on premises, in the cloud, or even in a third-party data center. 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
  • 12.
  • 13.
  • 14.
    @moficodes Serving ● User Istiobehind the scene ● Used for intelligent routing, blue-green deployment ● Scales to zero
  • 15.
  • 16.
  • 17.
    @moficodes Knative Build It's anopen-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.
  • 18.
    @moficodes Key features ofKnative 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, whether that's a single step in a process, or the whole process itself. ● The steps in a Build can push to a repository. ● A BuildTemplate can be used to defined reusable templates. ● The source in a Build can be defined to mount data to a Kubernetes Volume, and supports: ○ git repositories ○ Cloud Storage ○ An arbitrary container image ● Authenticate with ServiceAccount using Kubernetes Secrets.
  • 19.
  • 20.
    @moficodes A/B Testing ● Graduallyshift traffic from one version to a newer version
  • 21.
  • 22.
  • 23.
    @moficodes Istio ● Automatic loadbalancing for HTTP, gRPC, WebSocket, and TCP traffic. ● Fine-grained control of traffic behavior with rich routing rules, retries, failovers, and fault injection. ● A pluggable policy layer and configuration API supporting access controls, rate limits and quotas. ● Automatic metrics, logs, and traces for all traffic within a cluster, including cluster ingress and egress. ● Secure service-to-service communication in a cluster with strong identity-based authentication and authorization.
  • 24.
  • 25.
  • 26.
    @moficodes Event Knative Eventing definesthe 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
  • 27.
    @moficodes Eventing Principles 1. Servicesare loosely coupled during development and deployed independently on a variety of platforms (Kubernetes, VMs, SaaS or FaaS). 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
  • 28.
  • 29.
    @moficodes IBM Open Source ●Istio ● Knative ● Nodejs ● Hyperledger ● Cloudfoundry ● OpenJ9 ● Mircroprofile ...And so many more
  • 30.
  • 31.
  • 32.