Last active
May 24, 2019 05:25
-
-
Save zeerorg/22ade7a438216b9f922c550a54984ac0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Deploy openfaas with k3d | |
command -v helm > /dev/null | |
if [ $? == "1" ]; | |
then | |
curl -s https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash | |
fi | |
command -v k3d > /dev/null | |
if [ $? == "1" ]; | |
then | |
curl -s https://raw.githubusercontent.com/rancher/k3d/master/install.sh | bash | |
fi | |
k3d create --wait | |
sleep 20 | |
export KUBECONFIG="$(k3d get-kubeconfig)" | |
echo 'To connect to cluster do: | |
export KUBECONFIG="$(k3d get-kubeconfig)" | |
' | |
kubectl -n kube-system create sa tiller \ | |
&& kubectl create clusterrolebinding tiller \ | |
--clusterrole cluster-admin \ | |
--serviceaccount=kube-system:tiller | |
helm init --skip-refresh --upgrade --wait --service-account tiller | |
# create namesapce | |
kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml | |
# add repo | |
helm repo add openfaas https://openfaas.github.io/faas-netes/ | |
# set password | |
PASSWORD="something" | |
# deploy | |
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 \ | |
--wait | |
kubectl port-forward svc/gateway-external 31112:8080 -n openfaas & | |
echo 'To close Port forwarding do: | |
kill ' | |
echo $! | |
echo '' | |
sleep 10 | |
export OPENFAAS_URL=http://localhost:31112 | |
echo -n $PASSWORD | faas-cli login -g $OPENFAAS_URL -u admin --password-stdin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment