Configs2026年4月15日·1 分钟阅读

OpenFaaS — Serverless Functions Made Simple

OpenFaaS is a framework for packaging code, binaries or containers as portable serverless functions that run on Kubernetes or containerd with autoscaling, metrics, and a rich CLI.

Introduction

OpenFaaS turns any container into a function with a uniform HTTP interface and scale-to-zero behavior. It is the most popular open-source FaaS platform and runs on anything that speaks the Kubernetes or containerd APIs — including Raspberry Pi clusters.

What OpenFaaS Does

  • Packages handlers as OCI images with a minimal watchdog process
  • Exposes functions behind a single gateway with auth and metrics
  • Autoscales via Prometheus alerts or HPA v2
  • Supports async invocations through NATS JetStream
  • Ships templates for Python, Node, Go, Ruby, Rust, PHP, Java and more

Architecture Overview

A gateway service (Go) routes HTTP requests to per-function Deployments; each function pod runs a watchdog that forks the handler or proxies HTTP. Metrics flow to Prometheus, which triggers scaling decisions. An optional queue-worker pulls async jobs from NATS and invokes functions with retries.

Self-Hosting & Configuration

  • arkade install openfaas or the openfaas Helm chart
  • faasd variant runs on a single VM via containerd (no K8s needed)
  • Use OPENFAAS_URL and basic-auth/OIDC for the gateway
  • Define functions in a stack.ymlfaas-cli up builds, pushes, deploys
  • Wire Prometheus + Grafana dashboards shipped with the chart

Key Features

  • True scale-to-zero with configurable idle timeout
  • Async invocations with NATS-backed retries and callbacks
  • Function templates store and of-watchdog streaming handlers
  • Works on ARM64 — great for edge and homelab
  • Pro version adds multi-tenancy, CRDs and single sign-on

Comparison with Similar Tools

  • Knative Serving — heavier, tied to Kubernetes and Istio/Contour
  • Fission — similar idea, pool-based cold starts, less active
  • AWS Lambda — managed only, provider lock-in
  • Kubeless — archived
  • Nuclio — data-science focused, richer triggers

FAQ

Q: Do I need Kubernetes? A: No — faasd runs the core stack on one VM with systemd + containerd.

Q: How do cold starts compare to Lambda? A: Warm pods are sub-10 ms; cold starts depend on image pull and usually land at 1–3 s.

Q: Can I use my own container image? A: Yes — set image: and fprocess: in stack.yml and skip the template.

Q: Is OpenFaaS CE still open source? A: Yes, MIT licensed; OpenFaaS Pro adds commercial features under EULA.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产