# Install the faas-cli
curl -sL https://cli.openfaas.com | sudo sh
# https://github.com/openfaas/faas-netes/blob/master/chart/openfaas/README.md
# Helm
curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash
# Tiller
kubectl -n kube-system create sa tiller \
&& kubectl create clusterrolebinding tiller \
--clusterrole cluster-admin \
--serviceaccount=kube-system:tiller
# openfaas and openfaas-fn namespaces
kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml
# Add the openfaas helm chart
helm repo add openfaas https://openfaas.github.io/faas-netes/
# basic authentication
PASSWORD=$(head -c 12 /dev/urandom | shasum| cut -d' ' -f1)
kubectl -n openfaas create secret generic basic-auth \
--from-literal=basic-auth-user=admin \
--from-literal=basic-auth-password="$PASSWORD"
# Deploy openfaas from the helm chart repo
helm repo update \
&& helm upgrade openfaas --install openfaas/openfaas \
--namespace openfaas \
--set basic_auth=true \
--set functionNamespace=openfaas-fn
# --set ingress.enabled=true
# Fetch public nodeport and set as env variable
kubectl get svc -n openfaas gateway-external -o wide
export OPENFAAS_URL=http://127.0.0.1:31112
# login and check connectivity
echo -n $PASSWORD | faas-cli login -g $OPENFAAS_URL -u admin --password-stdin
faas-cli version
# in production add letsencrypt to the ingresscontroller
https://docs.openfaas.com/reference/ssl/kubernetes-with-cert-manager/