Kubeless is a native serverless framework based on Kubernetes that allows users to deploy a small amount of code (functions) without worrying about the underlying architecture. It is deployed on Kubernetes clusters 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 are summarized below:
The features of Kubeless are built on top of Kubernetes. It is easy for people unfamiliar with Kubernetes to deploy Kubeless. Its main implementation is to convert user-written functions into CRDs (Custom Resource Definition, custom resources) in Kubernetes and run them in the cluster as containers.
Create a Kubeless service on an existing Kubernetes cluster:
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, the following figure is displayed:
Install and Configure Kubeless
View the basic information:
kubectl get pods -n kubeless
The relevant Pod information is shown in the figure below:
View Kubeless Relevant Pod
View the Deployment information:
kubectl get deployment -n kubeless
The relevant information is shown in the figure below:
View Kubeless Deployment-Relevant Information
View customresourcedefinition
information:
kubectl get customresourcedefinition
Its relevant information is shown in the figure below:
View customresourcedefinition
Information
Download the Kubeless tool and decompress it:
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, view:
./bundles/kubeless_linux-amd64/kubeless
The details are shown in the figure:
Use the Kubeless Command Line Tool
Create a test code helloworld.py
:
def hello(event, context): print(event) return event['data']
Deployment Project:
./bundles/kubeless_linux-amd64/kubeless function deploy hello-world --runtime python3.6 --from-file helloworld.py --handler helloworld.hello
After the deployment is successful, view the project information below:
kubectl get functions
The list of functions is shown in the figure:
View the Function List
View instance functions:
./bundles/kubeless_linux-amd64/kubeless function ls
The function state is shown in the figure below:
Trigger function:
./bundles/kubeless_linux-amd64/kubeless function call hello-world --data 'Hello world!'
After the trigger is completed, you will see the output below:
View the logs output in the instance, as shown in the figure:
View Logs in an Instance
So far, we have successfully created the Kubeless service on the Kubernetes cluster and experienced the Hello World implementation of Kubeless.
8 Key Trends in Serverless: A Detailed Analysis of Its Usage in the Real World
Serverless Engineering Practices | The Self-Built Apache OpenWhisk Platform
97 posts | 7 followers
FollowAlibaba Cloud Storage - June 4, 2019
Alibaba Cloud Storage - June 4, 2019
Alibaba Cloud Serverless - June 23, 2021
Alibaba Cloud Serverless - February 17, 2023
Alibaba Developer - August 8, 2019
Alibaba Cloud Serverless - June 9, 2022
97 posts | 7 followers
FollowAlibaba Cloud Container Service for Kubernetes is a fully managed cloud container management service that supports native Kubernetes and integrates with other Alibaba Cloud products.
Learn MoreAlibaba Cloud Function Compute is a fully-managed event-driven compute service. It allows you to focus on writing and uploading code without the need to manage infrastructure such as servers.
Learn MoreProvides a control plane to allow users to manage Kubernetes clusters that run based on different infrastructure resources
Learn MoreHigh Performance Computing (HPC) and AI technology helps scientific research institutions to perform viral gene sequencing, conduct new drug research and development, and shorten the research and development cycle.
Learn MoreMore Posts by Alibaba Cloud Serverless