andrevtg / kong-openfaas

Kong Ingress Controller + OpenFaas integration sample

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kong-openfaas

Kong Ingress Controller + OpenFaas integration sample

What you need

What to do (k3d)

Create a local cluster with k3d

Use k3d to create a local development cluster:

k3d create -n kong-local \
  --publish 8080:32080 \
  --workers="1" \
  --server-arg "--no-deploy=traefik" \
  --server-arg "--no-deploy=servicelb"

The arguments abova disable Trefik (a default on k3d), since we want Kong as Ingress Controller instead. After cluster is created you can obtain its KUBECONFIG:

export KUBECONFIG="$(k3d get-kubeconfig --name='kong-local')"
kubectl cluster-info

Deploy OpenFaas using arkade

arkade install openfaas --load-balancer="false" --basic-auth-password "password" --operator="true"

Deploy Kong Ingress Controller

We need Kong official helm chart and our custom ingress:

helm repo add kong https://charts.konghq.com
helm repo update
helm upgrade -i kong kong/kong --version 1.5.0 \
  --set ingressController.installCRDs=false \
  --set ingressController.enabled=true \
  --set proxy.type=NodePort \
  --set proxy.http.enabled=true \
  --set proxy.http.nodePort=32080
kubectl apply -f ingress.yml

Open OpenFaas Gateway

Create an entry in /etc/hosts:

127.0.0.1 	gateway.localdomain

Open "http://gateway.localdomain:8080/ui/" in you browser and you are good to go.

Try installing and invoking the figlet function from the store.

Using faas-cli

export OPENFAAS_URL=http://gateway.localdomain:8080
faas-cli login --password password -u admin
echo -n OpenFaaS | faas-cli invoke figlet

About

Kong Ingress Controller + OpenFaas integration sample

License:GNU General Public License v3.0