Skip to content

Instantly share code, notes, and snippets.

@ruanbekker
Last active October 16, 2019 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruanbekker/0f3725fec000564624788c465962ddae to your computer and use it in GitHub Desktop.
Save ruanbekker/0f3725fec000564624788c465962ddae to your computer and use it in GitHub Desktop.
Install OpenFaas with Helm on Kubernetes
#!/usr/bin/env bash
# install k3d on ubuntu:
# https://gist.githubusercontent.com/ruanbekker/9c5471a4a152be16e66d5c1157452e88/raw/3a310975558b56b2cdd796082c4995903d2ef473/bootstrap_k3d.sh
source /root/.kubernetes.sh
curl -sL https://cli.openfaas.com | sudo sh
curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash
kubectl -n kube-system create sa tiller \
&& kubectl create clusterrolebinding tiller \
--clusterrole cluster-admin \
--serviceaccount=kube-system:tiller
sleep 10
helm init --skip-refresh --upgrade --service-account tiller
sleep 10
kubectl get pods -n kube-system
kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml
helm repo add openfaas https://openfaas.github.io/faas-netes/
export PASSWORD=$(head -c 12 /dev/urandom | shasum| cut -d' ' -f1)
echo ${PASSWORD} > /root/.openfaas-password.txt
kubectl -n openfaas create secret generic basic-auth \
--from-literal=basic-auth-user=admin \
--from-literal=basic-auth-password="$PASSWORD"
helm repo update \
&& helm upgrade openfaas \
--install openfaas/openfaas \
--namespace openfaas \
--set basic_auth=true \
--set functionNamespace=openfaas-fn \
--set serviceType=LoadBalancer
#--set ingress.enabled=true
sleep 20
kubectl --namespace=openfaas get deployments -l "release=openfaas, app=openfaas"
export OPENFAAS_URL=http://127.0.0.1:31112
kubectl port-forward -n openfaas svc/gateway --address 0.0.0.0 31112:8080 &
echo "URL: http://$(curl -s ip4v.icanhazip.com):31112"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment