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 install Kubeless of Serverless framework

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

Share

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

This article mainly introduces how to install the Kubeless of Serverless framework, which is very detailed and has certain reference value. Friends who are interested must finish it!

1. Create namespaces, create kubeless control management containers

> kubectl create ns kubeless

# install kubens that is convenient to switch spaces by yourself

> kubens kubeless

# create a Kubeless Controller Manager container based on the official yaml:

> kubectl create-f https://github.com/kubeless/kubeless/releases/download/v1.0.7/kubeless-non-rbac-v1.0.7.yaml

In # kubless space, you can view the following pod

> kubectl get pods

NAME READY STATUS RESTARTS AGE

Kubeless-controller-manager-59d484f4d-5v7nv 3/3 Running 0 26m

two。 Download, configure kubeless client

# this is Mac, so download the Mac version of

Wget https://github.com/kubeless/kubeless/releases/download/v1.0.7/kubeless_darwin-amd64.zip

# after decompression

> cp bundles/kubeless_darwin-amd64/kubeless / usr/local/bin/

3. Try a bull's knife

# create a hello.py file with the following contents:

# print the event event and return the data content of event

Def hello (event,context):

Print (event)

Return event ['data']

# run it in kubeless space

> kubeless function deploy hello-runtime python3.8-from-file hello.py-handler hello.hello

# the task is executed normally, and the response is as follows:

INFO [0000] Deploying function...

INFO [0000] Function hello submitted for deployment

INFO [0000] Check the deployment status executing 'kubeless function ls hello'

# check the function that just ran

> kubeless function ls hello-o wide

AME NAMESPACE HANDLER RUNTIME TYPE TOPIC DEPENDENCIES STATUS MEMORY ENV LABEL SCHEDULE

Hello kubeless hello.hello python3.8 1/1 READY created-by: kubeless

Function: hello

Trigger to verify:

a. Verify through the kubeless command line:

> kubeless function call hello-- data'{"hello": "world"}'

# return

{"hello": "world"}

b. Use Kubeless UI to call

i. Install kubeless UI: (https://github.com/kubeless/kubeless-ui)) first

# the default space here is kubeless

> kubectl create-f https://raw.githubusercontent.com/kubeless/kubeless-ui/master/k8s.yaml

# you can check the status, as shown below: Running has been installed

> kubectl get pods

NAME READY STATUS RESTARTS AGE

Hello-684545b7c6-sf6sz 1/1 Running 0 16m

Kubeless-controller-manager-59d484f4d-5v7nv 3/3 Running 0 59m

Ui-698c9989-tlw2b 2/2 Running 0 80s

# looking at the service, you can see the virtual IP of the service

> kubectl get svc

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT (S) AGE

Hello ClusterIP 10.105.236.229 8080/TCP 17m

Ui NodePort 10.111.144.93 3000:31997/TCP 2m33s

c. Use kubectl proxy to call

# enable proxy

> kubectl proxy-- port=9999

# return

Starting to serve on 127.0.0.1:9999

# visit and take a look

> curl-L-data'{"hello": "world again"}'--header "Content-Type:application/json" http://localhost:9999/api/v1/namespaces/kubeless/services/hello:8080/proxy/

# return

{"hello": "world again"}

The above is all the contents of the article "how to install Kubeless for Serverless Framework". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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