在Ubuntu(20.04LTS) 上安装Kubernetes(1.21.3)并搭建OpenFaaS环境
基本上,按照这里的步骤进行操作。
前提
- Docker和Kubernetes已被安装好了。
安装faas-cli
如果在部署之前不安装,Pod将无法启动。
curl -sLSf https://cli.openfaas.com | sudo sh
Finding latest version from GitHub
0.14.1
Downloading package https://github.com/openfaas/faas-cli/releases/download/0.14.1/faas-cli as /tmp/faas-cli
Download complete.
Running with sufficient permissions to attempt to move faas-cli to /usr/local/bin
New version of faas-cli installed to /usr/local/bin
Creating alias 'faas' for 'faas-cli'.
___ _____ ____
/ _ \ _ __ ___ _ __ | ___|_ _ __ _/ ___|
| | | | '_ \ / _ \ '_ \| |_ / _` |/ _` \___ \
| |_| | |_) | __/ | | | _| (_| | (_| |___) |
\___/| .__/ \___|_| |_|_| \__,_|\__,_|____/
|_|
CLI:
commit: d94600d2d2be52a66e0a15c219634f3bcac27318
version: 0.14.1
OpenFaaS的复刻版本。
git clone https://github.com/openfaas/faas-netes
创建命名空间
cd faas-netes
kubectl apply -f namespaces.yml
制造秘密。
kubectl -n openfaas create secret generic basic-auth --from-literal=basic-auth-user=admin --from-literal=basic-auth-password=password
secret/basic-auth created
制作Pod
在克隆的git中的faas-netes目录中执行
kubectl apply -f ./yaml
configmap/alertmanager-config created
deployment.apps/alertmanager created
service/alertmanager created
deployment.apps/basic-auth-plugin created
service/basic-auth-plugin created
serviceaccount/openfaas-controller created
role.rbac.authorization.k8s.io/openfaas-controller created
role.rbac.authorization.k8s.io/openfaas-profiles created
rolebinding.rbac.authorization.k8s.io/openfaas-controller created
rolebinding.rbac.authorization.k8s.io/openfaas-profiles created
deployment.apps/faas-idler created
deployment.apps/gateway created
service/gateway-external created
service/gateway created
deployment.apps/nats created
service/nats created
customresourcedefinition.apiextensions.k8s.io/profiles.openfaas.com created
configmap/prometheus-config created
deployment.apps/prometheus created
serviceaccount/openfaas-prometheus created
role.rbac.authorization.k8s.io/openfaas-prometheus created
role.rbac.authorization.k8s.io/openfaas-prometheus-fn created
rolebinding.rbac.authorization.k8s.io/openfaas-prometheus created
rolebinding.rbac.authorization.k8s.io/openfaas-prometheus-fn created
service/prometheus created
deployment.apps/queue-worker created
确认状态
尽管faas-idler没有启动,但应用本身是可以启动的。
kubectl -n openfaas get deploy
NAME READY UP-TO-DATE AVAILABLE AGE
alertmanager 1/1 1 1 15m
basic-auth-plugin 1/1 1 1 15m
faas-idler 0/1 1 0 15m
gateway 1/1 1 1 15m
nats 1/1 1 1 15m
prometheus 1/1 1 1 15m
queue-worker 1/1 1 1 15m
Web-UI访问
因为被要求进行基本认证,所以输入先前创建的秘钥的内容。
