@moficodes
The What, Why and How
of Knative
@moficodes
Level Set
@moficodes
Microservices?
@moficodes
Containers?
@moficodes
Container
Orchestration?
@moficodes
Kubernetes?
@moficodes
Serverless?
@moficodes
Mofizur Rahman
Developer Advocate, IBM
Do Container Stuff, Collect Stickers, Write go code
@moficodes
@moficodes
Agenda
Learn About Knative and Why We Should Care
See Some “Cool” Demo
Learn Whats to Come Next
Be Impressed With Mofi
@moficodes
Microservice Architecture
● Modular Software
Development
● Small Services
● Independently
Deployable
@moficodes
Microservice Architecture
● Products not Projects
● Design for Failures
● Organized Around Business Capabilities
@moficodes
It’s Basically a Distributed Monolith
@moficodes
Microservices and Containerization
● Better resource utilization
● Portable solution
● Container orchestration
@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
@moficodes
What is
Serverless?
@moficodes
Serverless
● Any platform that can do on demand work.
● Run atomic (in theory) actions aka
functions.
● Scales according to need
@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
@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 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
@moficodes
Why Knative
● Serverless capabilities on K8s
● Extend K8s in a native way
● Higher level primitives
● More complete platform
@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
@moficodes
Extend K8s in a Native Way
● Make use of existing skills
● Get to use standard tools
● 3rd party tool support is better
@moficodes
Higher Level Primitives
● Combines bunch of K8s operations in higher
level primitives
● Enables automation
@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
@moficodes
Install Knative
@moficodes
@moficodes
@moficodes
@moficodes
Serving
● Uses Istio behind the scene
● Used for intelligent routing, blue-green
deployment
● Scales to zero
● Scale to limit
@moficodes
Demo
@moficodes
@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
● 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.
@moficodes
Demo
@moficodes
Blue/Green Deployment
● Gradually shift traffic from one version to a newer
version
Also See Canary Deployment, A/B Testing
@moficodes
@moficodes
100%
V1
@moficodes
100%
V1
0% V2
@moficodes
100%
V1
0% V2
@moficodes
50%
V1
50%
V2
@moficodes
0% V1
100%
V2
@moficodes
@moficodes
Demo
@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.
@moficodes
And almost 0
code changes
@moficodes
@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
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
Knative on IKS
@moficodes
Learn More at
developer.ibm.com/tutoials/knative-101-labs
https://knative.dev
@moficodes
Whats Next?
@moficodes
Mofizur Rahman
Developer Advocate, IBM
@moficodes
@moficodes
Thank You

The what, why and how of knative