Environment Variables
Namespaces
You only need to set this if there are multiple Fission installations in different namespaces within the same Kubernetes cluster.
Set FISSION_NAMESPACE to the namespace where the Fission installed.
$ export FISSION_NAMESPACE=<namespace>
If you run functions in a separate namespace, set FISSION_FUNCTION_NAMESPACE to that namespace.
By default the Helm chart creates functions in the defaultNamespace value (which is default), so you only need this when you have changed functionNamespace or are targeting a non-default function namespace.
$ export FISSION_FUNCTION_NAMESPACE=<namespace>
Fission Router Address
You don’t need to set this if you’re simply running fission function test --name <fn>, because Fission CLI uses local port-forward mechanism to talk to router pod.Fission CLI uses value in FISSION_ROUTER_URL if it’s not empty instead of using local port-forward mechanism.You need to ensure that the IP address in it is accessible from the public network.It’s convenient to set the FISSION_ROUTER_URL environment variable to the externally-visible address of the Fission router.
Clusters that only support NodePort
Here we use minikube as an example.
$ export FISSION_ROUTER_URL=$(minikube ip):$(kubectl -n fission get svc router -o jsonpath='{...nodePort}')
This resolves to IP (from minikube):PORT (from the fission router), for example 192.168.99.110:30722, and is stored in the FISSION_ROUTER_URL environment variable.
Cloud Hosted Clusters
If you want to expose the router to the internet, the service type of router service must be set to LoadBalancer.
This is the default in the helm chart.
$ kubectl --namespace fission get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
router LoadBalancer 10.107.80.21 <pending> 80:31314/TCP 11d
If the field EXTERNAL-IP shows <pending>, it means that kubernetes is waiting for cloud provider to allocate the public IP address.
It often takes a few minutes to get an IP address.
Then:
# AWS
$ export FISSION_ROUTER_URL=$(kubectl --namespace fission get svc router -o=jsonpath='{..hostname}')
# GCP
$ export FISSION_ROUTER_URL=$(kubectl --namespace fission get svc router -o=jsonpath='{..ip}')
Check whether there are firewall rules that block you from accessing the IP address.
Troubleshooting
If your cluster is running in an environment that does not support external load balancer (e.g., minikube), the EXTERNAL-IP of fission router will stay in pending state.
$ kubectl --namespace fission get svc router
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
router LoadBalancer 10.39.253.73 <pending> 80:31377/TCP 27d
In this case, you can use the port-forward method instead:
# Port-forward
$ kubectl --namespace fission port-forward $(kubectl --namespace fission get pod -l svc=router -o name) <local port>:8888 &
$ export FISSION_ROUTER_URL=127.0.0.1:<local port>
Now, curl http://${FISSION_ROUTER_URL}/ opens a connection that goes through the port-forward you just created.
This is useful for local testing of your function.