Last active
October 16, 2019 10:01
-
-
Save ruanbekker/0f3725fec000564624788c465962ddae to your computer and use it in GitHub Desktop.
Install OpenFaas with Helm on Kubernetes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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