Skip to content

Instantly share code, notes, and snippets.

@LucasRoesler
Last active November 24, 2019 21:57
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save LucasRoesler/c029f7b7446f7c051522b8edb456b703 to your computer and use it in GitHub Desktop.
Create a new dev environment using KinD and immediately forward the Gateway port
#!/bin/bash
DEVENV=${1:-devopenfaas}
kind create cluster --name "$DEVENV"
export KUBECONFIG="$(kind get kubeconfig-path --name="$DEVENV")"
kubectl rollout status deploy coredns --watch -n kube-system
# INSTALLING HELM
kubectl -n kube-system create sa tiller \
&& kubectl create clusterrolebinding tiller \
--clusterrole cluster-admin \
--serviceaccount=kube-system:tiller
helm init --skip-refresh --upgrade --service-account tiller
# SETUP REQUIRED NAMESPACES
kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml
# CONFIGURE BASIC AUTH
export PASSWORD="tester"
kubectl -n openfaas create secret generic basic-auth \
--from-literal=basic-auth-user=admin \
--from-literal=basic-auth-password="$PASSWORD"
# INSTALL OPENFAAS VIA HELM
helm repo add openfaas https://openfaas.github.io/faas-netes/
helm repo update
kubectl rollout status deploy tiller-deploy --watch -n kube-system
helm upgrade openfaas --install openfaas/openfaas \
--namespace openfaas \
--set basic_auth=true \
--set functionNamespace=openfaas-fn
kubectl rollout status deploy gateway --watch -n openfaas
echo ""
echo "OpenFaaS started!"
printf '%-15s:\t %s\n' "Username" "admin"
printf '%-15s:\t %s\n' "Password" "tester"
printf '%-15s:\t %s\n' "CLI run" "faas-cli login --username admin --password tester --gateway http://localhost:31112"
echo ""
## In a new terminal
kubectl -n openfaas port-forward deploy/gateway 31112:8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment