Skip to content

Instantly share code, notes, and snippets.

@sachinsu
Last active February 25, 2019 05:20
Show Gist options
  • Save sachinsu/1785ac68221d093559623dd0716696c1 to your computer and use it in GitHub Desktop.
Save sachinsu/1785ac68221d093559623dd0716696c1 to your computer and use it in GitHub Desktop.
Run OpenFaas on Windows 10 Home Edition with Minikube and Virtualbox
# Install Virtualbox (from here)[https://www.virtualbox.org/wiki/Downloads]
# Install Kubectl, refer (here)[https://kubernetes.io/docs/tasks/tools/install-minikube/#install-kubectl]
# Install Minikube, refere (here)[https://kubernetes.io/docs/tasks/tools/install-minikube/#install-minikube)
# Install Helm by following instructions at (Helm)[https://github.com/helm/helm/blob/master/docs/install.md]
# Install faas-cli, refer (here)[https://docs.openfaas.com/cli/install/]
# Start Windows Powershell using Run as Administrator
# Update Path variable by adding paths to above utilities using `$env:Path += "c:\path_to_kubectl"`
# Run `minikube start` - This will download VM image and set it up in Virtualbox and kick off K8s Cluster.
# Run `& minikube docker-env | Invoke-Expression` - This means that any Docker images built will be built in your minikube, so they are readily available.
# clond faas-netes repository using `git clone https://github.com/openfaas/faas-netes.git`.
# repare a namespace and service account for tiller (helm server) via `kubectl -n kube-system create sa tiller`
then run `kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller`
# Install tiller using `helm init --skip-refresh --upgrade --service-account tiller`
# Change directory so that you are inside the faas-netes/chart directory via cd `faas-netes/chart`
# Edit the openfaas/values.yml file so that the faasnetesd component has the configuration value imagePullPolicy: "IfNotPresent" set. This is what will allow us to run our local Docker images.
# Install OpenFaas using helm using `helm upgrade --install --debug --reset-values --set async=false openfaas openfaas/`
# Use the command that is given in the output to wait until OpenFaas is up and running.
Run a Openfaas function on Kubernetes,
# Create a new function using `faas-cli new --lang go hello`
# Use faas-cli to build the function which essentially builds the Docker image (note, this will wind up on your minikube VM) using `faas-cli build -f hello.yml`
# Note the Url for OpenFaas gateway which will be http://`$(minikube ip)`:31112.
# Deploy the function to OpenFaas using `faas-cli deploy -f hello.yml --gateway <url>`.
# Test the function using `echo test | faas-cli invoke hello --gateway <url>`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment