Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy and manage Kubeless functions using Kubeless Serverless Plugin

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

How to use Kubeless Serverless Plugin to deploy and manage Kubeless functions, I believe that many inexperienced people do not know what to do. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Kubeless is a native Serverless solution for Kubernetes.

Serverless Framework is a command line tool that supports deploying functions to different platforms (such as AWS Lambda, Azure Functions, Google CloudFunctions, Tencent Cloud function SCF, etc.) and managing them.

Kubeless Serverless Plugin makes it possible to deploy functions to Kubeless through Serverless Framework.

The use of Kubeless Serverless Plugin to deploy and manage Kubeless functions is described below.

Environment description

Operating system: macOS

Kubernetes version: v1.15.5

Kubeless version: v1.0.7

Install serverless

Serverless can be installed through the npm command:

$npm install serverless-g sample experience

Use git to clone the serverless-kubeless repository and view the sample functions.

There are several key fields in serverless.yml: service, provider, plugins, functions, with name and runtime under provider.

You can see from the contents of the package.json file that the dependency includes serverless-kubeless.

$git clone https://github.com/serverless/serverless-kubeless$ cd serverless-kubeless/examples/get-python$ cat serverless.ymlservice: helloprovider: name: kubeless runtime: python2.7plugins:-serverless-kubelessfunctions: hello: description: 'Hello function' handler: handler.hello$ cat package.json {"name": "hello", "version": "1.0.0", "description": "Example function for serverless kubeless" "dependencies": {"serverless-kubeless": "^ 0.7.0"}, "devDependencies": {}, "scripts": {"test": "echo\" Error: no test specified\ "& exit 1"}, "author": "", "license": "Apache-2.0"}

Download dependency, Taobaoyuan is used here:

$npm install-- registry= https://registry.npm.taobao.org

Deployment function:

$serverless deployServerless: Packaging service...Serverless: Excluding development dependencies...Serverless: Deploying function hello...Serverless: Function hello successfully deployed

View the function status:

$kubectl get functionNAME AGEhello 2m1s $kubectl get podNAME READY STATUS RESTARTS AGEhello-68d57655b4-cfk6b 1Acer 1 Running 0 2m16s

Call the function:

$serverless invoke-f hello-lServerless: Calling function: hello...----hello world

View the function log:

$serverless logs-f hello10.1.0.1-- [09/Oct/2020:09:23:17 + 0000] "GET / HTTP/1.1" 20011 "009/Oct/2020:09 1053210.1.0.1-- [09/Oct/2020:09:23:37 + 0000]" GET / healthz HTTP/1.1 "2002" kube-probe/1.16+ "0Compare 13810.1.0.1-- [09/Oct/2020:09 : 24:07 + 0000] "GET / healthz HTTP/1.1" 2002 "" kube-probe/1.16+ "0cit182

Get function information:

$serverless infoService Information "hello" ClusterIP: 10.107.27.134Type: ClusterIPPorts: Name: http-function-port Protocol: TCP Port: 8080 Target Port: 8080Function InfoDescription: Hello functionLabels: created-by: kubeless function: helloHandler: handler.helloRuntime: python2.7Dependencies:

After modifying the function, redeploy:

$serverless deploy function-f hello

A problem was encountered here, which led to the failure of function redeployment. For more information, please see: https://github.com/serverless/serverless-kubeless/issues/201

Delete function:

$serverless removeServerless: Removing function: hello... After reading the above, have you mastered how to deploy and manage Kubeless functions using Kubeless Serverless Plugin? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report