Serverless Engineering Practice | Quickly Build Kubeless Platform

Serverless Engineering Practice | Quickly Build Kubeless Platform

Quickly build a Kubeless platform

Introduction to Kubeless

Kubeless is a native serverless framework based on Kubernetes. It allows users to deploy small amounts of code (functions) without having to worry about the underlying architecture. It is deployed on a Kubernetes cluster and makes full use of Kubernetes' features and resource types to clone content on AWS Lambda, Azure Functions, and Google Cloud Functions.

The main features of Kubeless can be summarized as follows.

Supports Python, Node.js, Ruby, PHP, Go, .NET, Ballerina languages ​​and custom runtimes.
The Kubeless CLI is compliant with the AWS Lambda CLI.
Event triggers use the Kafka messaging system and HTTP triggers.
By default, Prometheus monitors function calls and delays.
Support Serverless framework plugin.

Since the features of Kubeless are built on Kubernetes, it is very easy for people familiar with Kubernetes to deploy Kubeless. Its main implementation is to convert user-written functions into CRDs (Custom Resource Definitions) in Kubernetes and run them in the cluster as containers.

Kubeless deployment

Create a Kubeless service on an existing Kubernetes cluster:

  1. export RELEASE =$(curl -s https://api.github.com/repos/kubeless/kubeless/releases/ latest | grep tag_name | cut -d '"' -f 4)kubectl create ns kubelesskubectl create -f https://github.com/kubeless/kubeless/releases/download/$RELEASE/ kubeless-$RELEASE.yaml

After successful creation, as shown in the figure

Install and configure Kubeless

View basic information:

kubectl get pods -n kubeless

The relevant Pod information is shown in the figure

View Kubeless related Pods

View the Deployment information:

kubectl get deployment -n kubeless

The relevant information is shown in the figure

View Kubeless Deployment related information

View the customresourcedefinition information:

kubectl get customresourcedefinition

The relevant information is shown in the figure

View customresourcedefinition information

Download command line tools

Download the Kubeless tool and decompress it:

  1. export OS =$(uname -s| tr '[:upper:]' '[:lower:]')curl -OL https://github.com/kubeless/kubeless/releases/download/$RELEASE/kubeless_ $OS-amd64.zipunzip kubeless_$OS-amd64.zip

After decompression, check:

./bundles/kubeless_linux-amd64/kubeless

As shown in the figure

Using the Kubeless command line tool

Experience Test

Create the test code helloworld.py:

def hello(event, context): print(event) return event['data']

Deploy the project:

  1. ./bundles/kubeless_linux-amd64/kubeless function deploy hello-world --runtime python3.6 --from-file helloworld.py --handler helloworld.hello

After successful deployment, view the project information:

kubectl get functions

The function list is shown in the figure

View the function list

View the example function:

./bundles/kubeless_linux-amd64/kubeless function ls

The function status is shown in the figure

Trigger function:

  1. ./bundles/kubeless_linux-amd64/kubeless function call hello-world --data 'Hello world!'

After the trigger is completed, you can see the output result:

View the log output in the instance, as shown in the figure

Viewing logs in an instance

So far, we have successfully created a Kubeless service on the Kubernetes cluster and successfully experienced the Kubeless version of Hello World implementation.

<<:  6G transmission capacity may be 100 times higher than 5G. 5G is here. How far is 6G?

>>:  Exploration and practice of full-link grayscale solution based on Istio

Recommend

Ethernet Packet Architecture

[[352785]] 01Overview The term Ethernet generally...

12 Ways 5G in Manufacturing Can Boost Industry 4.0

We’re on the cusp of a new era of connectivity, b...

How far can a SaaS company go? Mainly determined by these two indicators

[[356547]] To see the current status of a SaaS co...

5G concepts are performing well. Who will become the best among the strong?

On Monday, the two markets showed a weak and vola...

Cloudxtiny: £1.5/month KVM-512MB/5G SSD/100GB/UK data center

Cloudxtiny is a hosting company from the UK, prov...

See if you can handle this kind of interview. How does TCP transmit reliably?

Preface Hello everyone, I am Amazing. It is the g...

How 5G frequencies affect range and speed

Experts say that while 5G technology is a huge im...

How do the three major operators promote cloud-network integration?

In recent years, with the rapid development of cl...

Omdia: Next-generation PON equipment market to reach nearly $8.9 billion in 2025

LightReading reported that Omdia pointed out in i...