Skip to content

Instantly share code, notes, and snippets.

@id0Sch
Last active October 26, 2017 08:08
Show Gist options
  • Save id0Sch/6f4d068032f9bd11f267301d1744ffdd to your computer and use it in GitHub Desktop.
Save id0Sch/6f4d068032f9bd11f267301d1744ffdd to your computer and use it in GitHub Desktop.

OpenFaas on Google Container Engine

Setting up faas-netes cli

TODO: add this step combine with https://github.com/openfaas/faas-netes/blob/master/HELM.md

gcloud container clusters get-credentials ${CLUSTER-NAME} --zone us-central1-a --project ${PROJECT-ID}
git clone https://github.com/openfaas/faas-netes
cd faas-netes

Step 1: Creating the function

faas-cli new FUNCTION_NAME --lang python

Step 2: Building the function

faas-cli build -f ./FUNCTION_NAME.yml

Step 3: Pushing the function's image to a Goggle Container Registry

setting up local docker to push to google container registry (based on this)

gcloud components install docker-credential-gcr
docker-credential-gcr configure-docker

the YAML of the function should contain

image: us.gcr.io/PROJECT-ID/faas/FUNCTION_NAME

push the function to the registry

faas-cli build -f ./FUNCTION_NAME.yml

Step 4: Deploying the function to GKE

TODO: add Kubernetes install steps OpenFaaS portal connect to the cluster and setup a proxy (Kubernetes Dashboard)

kubectrl proxy

setup the gateway in the project's YAML (building the url)

provider:
  name: faas
  gateway: http://localhost:8001/api/v1/proxy/namespaces/default/services/gateway:8080

deploy the function

faas-cli deploy -f ./FUNCTION_NAME.yml

Using the dashboard localy

choose the gateway service using

kubectl -n openfaas get pods

init the port forwarding

kubectl -n openfaas port-forward gateway-pod-name 8080:8080

simple navigate to the dash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment