Introduction to Serverless Framework Working Architecture

November 07, 2018 

Introduction to Serverless Framework Working Architecture

What is Serverless?

Serverless is serverless computing to build and run applications and services without thinking about the servers. In this Serverless computing, there is the abstraction of servers and infrastructure and Operating Systems. To build serverless apps, don't need to provision and manage any servers. Serverless allows to focus from the server-level to the task-level.

What is Kubeless?

Kubeless is an open source serverless framework run on top of Kubernetes. Kubeless allows to deploy code without having to worry about infrastructure. Kubeless uses Kubernetes resources to provide auto-scaling, routing, monitoring, and troubleshooting. Requirement is to create and deploy function exposed via three possible types of the trigger mechanism.

  • pubsub triggered
  • http triggered
  • schedule triggered

Pubsub triggered managed with Kafka cluster, built-in component in Kubeless installation package while HTTP triggered, exposed with Kubernetes services and schedule function translates to a job. Python, NodeJS, and Ruby and .Net core are supported currently.


How Kubeless Works?

Kubeless creates a Custom Reference Definition called Function, create a function as a common Kubernetes resource, in the background a controller forms, it will watch over these custom resources and will launch on-demand. Some basic knowledge of Kubernetes concepts is required. A working Kubernetes cluster and Minikube. Kubectl CLI gets installed.

  • Client Application - The User Interface of application is best-rendered client side in Javascript to use a simple and a static web-server.
  • Web Server - In AWS there is a service named Amazon S3 to provide a robust and straightforward web-server. The static website of files like HTML, and Js for the application served from simple storage service.
  • FaaS Solution - FaaS is the way to enable in Serverless. Examples of FaaS are AWS Lambda, Google Cloud, and Microsoft Azure Function. In AWS there is also service called AWS lambda used for this framework. It is an application service for logging in and accessing data built as a Lambda function. Therefore more functions will read and write from database and provide JSON responses.
  • Security Token Services (STS) - It will generate temporary AWS credentials for users of the application. These temporary credentials used by the client application to invoke the AWS API.
  • User Authentication - AWS Cognito, an identity service integrated with AWS Lambda. With Amazon Cognito, easily adds user Sign up and Sign in to mobile and web apps. It also has the option to authenticate users through social identify providers such as Facebook, Twitter or Amazon.
  • Database - In AWS there is also service named as AWS DynamoDB which provides fully managed databases.

Why Kubeless Matters?

Serverless is all about services. In nowadays the world of IT is moving at some pace away from Iaas and next Paas. PaaS is not concerned about the physical infrastructure; its focus is on providing a discrete capability. Everything depends upon which type of services used.

  • Serverless services cost as per use.
  • Failover or backup systems are not often required.
  • No need to pay to produce or maintain Hardware or Software or other Virtual.
  • Well defined SLA's.
  • Quickly deploy, build, release.
  • Software scales up/down according to business need.
  • Easily to work on it.

Benefits of Kubeless

Easier Operational Management - It provides a separation between the infrastructure service and application running on it. Automatic Scaling functionality of FaaS reduces not only computation cost but also reduces Operational Management overheads. System Engineers and SRE's focuses on managing and running the underlying platform and core services such as databases and load balancers while product engineers manage the functions running on the top of the platform.

Faster Innovation - Product engineers innovate at a rapid pace as Serverless has the problems of system engineering in the platform. Thus less time for operations translates into a smooth application of DevOps and Agile methodologies. Demand Management and storage of applications using FaaS.

Reduced Operational Costs - Similar to IaaS and PaaS, infrastructure and human resource cost reduction is the primary advantage of the serverless architecture logic. In Serverless solution, pay to manage the servers, the databases, and application logic.


How to Adopt Kubeless?

  • Create a namespace for Kubeless Components.
  • Download latest version of Kubeless and Deploy into cluster.
  • Deploy the code.
  • It creates central pod and service responsible for displaying messages from Kubeless service.
  • There are several ways to get access to service, use Kubernetes Proxy command to check service.
  • Service hits each time when new data saved into application database.Simulate use case using Kubeless CLI Command.
  • Download two more files, view the requirements file and worker’s code.
  • Use Kubeless CLI to create topics easily.
  • Go to browser and navigate.
  • Main service listens to messages, trigger the worker.
  • View data stream in the browser.
  • It makes more comfortable with a complete Graphical User Interface to interact and use Kubeless.
  • Now to access Kubeless-UI service , retrieve Kubernetes master URL.
  • Get random IP provided to service from Kube-api.
  • Use port and finally access the UI via address.
  • Create full and functional services while working with Kubernetes Cluster.

Best Practises of Kubeless

  • Map application.
  • At Function level, apply perimeter security.
  • Minimal roles for each function.
  • Application dependencies are secure.
  • Against Bad Code always stay vigilant.
  • For Service Configuration CI/CD & Production add tests.
  • The flow of information observed.
  • Always FaaS Containers refresh.

Top Serverless Tools