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 use Heml to install and use OpenFaaS in Kubernetes

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

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to use Heml to install and use OpenFaaS in Kubernetes. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Introduction to OpenFaaS

OpenFaaS ®- Serverless Functions Made Simple

Download the OpenFaaS driver for Kubernetes, faas-netes:

Git clone https://github.com/openfaas/faas-netes & & cd faas-netesor domestic Code Cloud Image: git clone https://gitee.com/mirrors/faas-netes.git & & cd faas-netes

OpenFaaS (Functions as a Service) [1] is a framework for building serverless functions with Docker and Kubernetes.

In short, OpenFaaS is a framework for building Serverless functionality using Docker, with first-level support for metrics. Any process can be packaged as a function that allows you to use a series of web events without repetitive boilerplate coding.

Helm

Before installing OpenFaaS, we need to install Helm 3 (we no longer need to use tiller).

Combined with the previous article Kubernetes study notes [2], start minikube:

Minikube start-image-mirror-country cneval $(minikube docker-env)

Install Helm:

Brew install kubernetes-helm

Use Helm to manage kubernetes applications [3]

Deploy OpenFaaS

In the minikube environment, first create two namespaces namespaces:

Kubectl apply-f https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml

Add OpenFaaS helm chart:

Helm repo add openfaas https://openfaas.github.io/faas-netes/

All right, let's try a simple release first:

Helm repo update\ & & helm upgrade openfaas--install openfaas/openfaas\-namespace openfaas\-- set functionNamespace=openfaas-fn\-- set generateBasicAuth=true

Follow the prompts to get the password:

Echo $(kubectl-n openfaas get secret basic-auth- o jsonpath= "{.data.basic-auth-password}" | base64-- decode) / / passwordLnMqQfE5PVva

Port 31112 is provided by default. We use the command $(minikube ip) to obtain the internal ip, access it through ip:31112, and enter the account number and the password provided above:

Hello Function

Let's start with our first serverless function.

Install faas-cli

As recommended in the figure above, we can install faas-cli to create and publish a Function.

$curl-sL cli.openfaas.com | sudo sh

I use mac, so I can also install it directly using brew:

Brew install faas-cli

Create a NodeJS function

Faas-cli new hellofaas-lang node

The whole project structure is as follows:

.├── handler.js └── package.json 's article on "how to install and use OpenFaaS with Heml in Kubernetes" ends here. I hope the above content can be helpful to you so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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