Ubuntu(20.04LTS)+Kubernetes(1.21.3)にOpenFaaS環境構築


基本はここの手順に従って行う。

前提

  1. Docker,Kubernetesはインストールされている状態

faas-cliインストール

deploy前にインストールしておかないと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

namespace作成

cd faas-netes
kubectl apply -f namespaces.yml

secrets作成

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アクセス

basic認証を聞かれるので、先程作成したsecretの内容を入力