Download KinD binary for your platform and move it to /usr/local/bin:
https://github.com/kubernetes-sigs/kind/releases/tag/v0.6.1
Get k3sup
curl -sSLf https://get.k3sup.dev | sudo sh
Install OpenFaaS with aggressively-tuned probes / check-intervals
k3sup app install openfaas \
--set basic_auth=true \
--set generateBasicAuth=false \
--set functionNamespace=openfaas-fn \
--set openFaasImagePullPolicy=IfNotPresent \
--set faasnetes.imagePullPolicy=IfNotPresent \
--set gateway.scaleFromZero=true \
--set faasIdler.dryRun=false \
--set faasIdler.inactivityDuration=2m \
--set faasnetes.readinessProbe.initialDelaySeconds=1 \
--set faasnetes.readinessProbe.timeoutSeconds=1 \
--set faasnetes.readinessProbe.periodSeconds=1 \
--set faasnetes.livenessProbe.initialDelaySeconds=1 \
--set faasnetes.livenessProbe.timeoutSeconds=1 \
--set faasnetes.livenessProbe.periodSeconds=1
kubectl rollout status -n openfaas deploy/gateway
kubectl -n openfaas port-forward deploy/gateway 8080:8080 &
# Login and port-forward
PASSWORD=$(kubectl get secret -n openfaas basic-auth -o jsonpath="{.data.basic-auth-password}" | base64 --decode; echo)
echo -n $PASSWORD | faas-cli login --username admin --password-stdin
Deploy a function, invoke it and then scale it to zero:
faas-cli deploy --name pycho --image theaxer/pycho:latest --fprocess='python index.py'
kubectl rollout status -n openfaas-fn deploy/pycho
faas-cli invoke pycho <<< "hi there"
kubectl scale -n openfaas-fn deploy/pycho --replicas=0
sleep 10
Now invoke from cold:
time faas-cli invoke pycho <<< "hi there"
kubectl logs -n openfaas deploy/gateway --tail 500 gateway|grep Scale
Thanks to Lucas Roesler / Alex Ellis for the instructions