Apache OpenServerless 介绍与入门指南

Apache OpenServerless 介绍与入门:云无关 Serverless 平台定位、Kubernetes + OpenWhisk 架构组成(operator/静态站点/Redis/MinIO/Postgres/FerretDB)、ops CLI 安装与子命令实测速览、四种部署形态与资源要求、0.9.0-incubating 版本状态

Apache OpenServerlessOpenServerlessApacheServerless云计算2026/10/15

Apache OpenServerless 介绍与入门指南

目标:介绍 Apache OpenServerless——一个基于 Kubernetes、以 Apache OpenWhisk 为 FaaS 引擎的开源云无关 Serverless 平台,覆盖项目定位与孵化状态、架构组成、版本现状、ops CLI 的下载安装与子命令实测速览、四种部署形态及资源要求;官方项目信息核实与 ops CLI 命令均在 Ubuntu 22.04 环境于 2026-10-15 实测完成(CLI 层面),平台部署实操本文未覆盖、以官方文档为准。

一、环境信息

  • 操作系统:Ubuntu 22.04(x86_64)
  • ops CLI:0.9.0-incubating+26i11g51-snapshot(GitHub release 发布于 2026-09-11,convenience build)
  • ops CLI 二进制:/usr/local/bin/ops(解包后 34,976,356 字节可执行文件)
  • CLI 运行时依赖:git(克隆 tasks 仓库)、curl、ssh(openssh-client)
  • ops 运行时数据目录:/root/.ops(ops -info 实测 OPS_HOME)
  • 信息核实方式:官方孵化器页面、官网文档页与 GitHub API 均于 2026-10-15 当日抓取
  • 实测边界:本文完成 CLI 下载/安装/帮助体系实测;未执行任何 ops setup 部署(原因与官方资源要求见第六章)

二、定位与孵化状态

2.1 项目定位(官方原文)

Apache OpenServerless 官方孵化器状态页原文(2026-10-15 实测抓取自 https://incubator.apache.org/projects/openserverless.html ):

"OpenServerless is an open source, cloud-agnostic, serverless platform. It offers a complete environment for serverless applications development, based on Kubernetes. With Apache OpenWhisk as its FaaS engine, it provides an unified developer experience with a plethora of services (SQL or noSQL databases, key-value stores, object storage, LLMs services, function schedulers) managed by the platform's core: the operator, along with tooling (the CLI) to simplify (and interact with) deployments, integrated IDE and starter application and optimized runtimes integrated with the staters."

"2024-06-17 Project enters incubation."

官方文档站(https://openserverless.incubator.apache.org/docs/ )meta 描述原文:

"Apache OpenServerless is an Open Source project, released under the Apache License 2.0 providing a portable and complete Serverless environment... Our goal is to make OpenServerless ubiquitous... runs in every Kubernetes. OpenServerless is based on Apache OpenWhisk, which provides a powerful, production-ready serverless engine."

拆解这段定位,得到四个关键词:

  • 云无关(cloud-agnostic):目标是"runs in every Kubernetes",不绑定特定云厂商;
  • 以 OpenWhisk 为 FaaS 引擎:函数计算内核直接采用 Apache OpenWhisk;
  • 平台核心是 operator:SQL/NoSQL 数据库、KV 存储、对象存储、LLM 服务、函数调度器等配套服务由 operator 统一管理;
  • 完整开发环境:CLI、集成 IDE、starter 应用、与 starter 集成的优化运行时。

2.2 孵化状态(必须知晓)

OpenServerless 是 Apache 孵化器 podling:2024-06-17 进入孵化,截至 2026-10-15 仍在孵化中(官网域名即 openserverless.incubator.apache.org)。官方 CLI 发布页与 quickstart 页均带有 DISCLOSER 免责声明(原文见 4.3 节),明确"项目尚未获得 ASF 完全背书"。评估选型时应把孵化状态、API 可能变动纳入考量。

三、架构组成

3.1 平台分层:Kubernetes + OpenWhisk + operator

按官方文档口径,平台自下而上分四层:

层组成说明
基础层Kubernetes一切服务与函数的运行底座;部署形态从单机 K3S 到云上托管 K8s 均可(第六章)
FaaS 引擎Apache OpenWhiskaction/triggers/rules/packages/activations 模型原样沿用;官方文档的参考章节即"derived for the official OpenWhisk documentation"
平台核心operator官方定位原文:"managed by the platform's core: the operator"——各类配套服务的部署、启停、状态管理由 operator 统一编排
接入层CLI(ops)与 IDE 集成开发者经 ops 完成部署、配置与函数管理;配合集成 IDE 与 starter 应用

3.2 可选服务矩阵

operator 管理下的可配置服务矩阵(来源:官方文档 installation/configure/services 页,2026-10-15 实测抓取;开关即官方给出的 ops config 命令):

服务说明开关命令
Static静态资源发布(需泛域名 DNS 配合)ops config enable --static
Redis内存 KV 存储/缓存ops config enable --redis
MinIO对象存储ops config enable --minio
Postgres关系型 SQL 数据库ops config enable --postgres
FerretDBMongoDB 兼容适配器(构建在 Postgres 之上,启用时强制连带启用 Postgres)ops config enable --mongodb

全开/全关:ops config enable --all / ops config disable --all。

运行时侧:基于 OpenWhisk 运行时模型,每个 action 由 proxy 进程加载执行,proxy 监听 8080 端口并实现 /init 与 /run 两个内部接口(来源:官方文档 reference/runtimes 页)。开发者通常不直接接触该协议,经 ops 的 action 任务即可完成部署与调用(第七章)。

四、版本状态:0.9.0-incubating 线

4.1 版本事实(GitHub API 实测,2026-10-15)

仓库最新发布物状态
apache/openserverless(主仓)最新 tag:v0.9.0-incubating-RC7(另有 RC3~RC6)无正式 GitHub Release(/releases/latest 实测 404)
apache/openserverless-cli(CLI 仓)release:v0.9.0-incubating+26i11g51-snapshot(published_at 2026-09-11)snapshot/convenience build,非官方 Apache release
apache/openserverless-task(tasks 仓)—ops 运行时按需克隆的任务仓库(ops -info 实测 OPS_REPO 指向它)

结论:当前版本线为 0.9.0-incubating,尚无正式(非 RC、非 snapshot)发布。跟踪版本请以主仓 tag 与 CLI 仓 release 页为准。

4.2 CLI convenience build 的定性

CLI 发布页与 quickstart 页均出现官方免责声明(原文摘录):

"⚠ DISCLAIMER The prebuilt binaries published on the openserverless-cli releases page are convenience builds only. They are not official Apache releases, ... The only official artifacts are the source releases; build from source with go install if you need a supported, production-grade installation. Apache OpenServerless is also an effort undergoing incubation at the Apache Software Foundation (ASF)... the project has yet to be fully endorsed by the ASF."

即:GitHub 上的预编译二进制只是便利构建;需要受支持的、生产级安装时应从源码构建:

go install github.com/apache/openserverless-cli/cmd/ops@0.9.0

4.3 CLI 下载实测(linux_amd64)

本文实测采用 GitHub 便利构建(日常体验足够,生产环境按 4.2 节走源码安装):

cd /opt
wget 'https://github.com/apache/openserverless-cli/releases/download/v0.9.0-incubating%2B26i11g51-snapshot/openserverless-cli_0.9.0-incubating%2B26i11g51-snapshot_linux_amd64.tar.gz'
wget 'https://github.com/apache/openserverless-cli/releases/download/v0.9.0-incubating%2B26i11g51-snapshot/checksums.txt'
sha256sum openserverless-cli_0.9.0-incubating%2B26i11g51-snapshot_linux_amd64.tar.gz

实测下载与校验:

4ae3a248979fb969dfecefe64650f5232ca3c1842b65db6527d461e741bd15ce  openserverless-cli_0.9.0-incubating%2B26i11g51-snapshot_linux_amd64.tar.gz

与官方 checksums.txt 中 linux_amd64 条目一致;压缩包 17,470,213 字节(wget 实测 2.3s 下载完成)。全平台资产(GitHub API 实测):darwin amd64/arm64、linux amd64/arm64、windows amd64.zip 及 checksums.txt。

解包与安装:

tar xzf openserverless-cli_0.9.0-incubating%2B26i11g51-snapshot_linux_amd64.tar.gz
install -m 0755 'openserverless-cli_0.9.0-incubating%2B26i11g51-snapshot_linux_amd64/ops' /usr/local/bin/ops
ops -version

包内含 ops 可执行(34,976,356 字节)、LICENSE、NOTICE、DISCLAIMER 四个文件。ops -version 实测:

0.9.0-incubating+26i11g51-snapshot

五、ops CLI 获取与速览

CLI 官方名称是 ops("ops is the OPen Serverless CLI"),源码仓 apache/openserverless-cli。4.3 节已完成安装,本节走一遍首跑初始化(含排障),再速览其帮助体系。

5.1 首跑初始化与依赖排障

ops 首次运行会自动初始化:克隆 tasks 任务仓库、按需下载 prerequisites(kubectl/kind/k3sup/helm 等管理工具)。在干净服务器上首次执行任意命令即触发:

ops --version

实测首跑输出(节选,自动初始化):

Welcome to ops! Setting up...
Cloning tasks...
Enumerating objects: 6908, done.

排障实录一:snapshot 版的"鸡生蛋"初始化循环。 初始化后任意命令报 error: cannot find opsfiles, download them with ops -update,而 ops -update 自身也报同一句。解法:先执行非交互重置 ops -reset force(注意 ops -reset 不带 force 会进入交互确认 Are you sure [yes/no]:,脚本环境会被 EOF 中止),再跑 ops -update,tasks 克隆成功(Tasks downloaded successfully)。

排障实录二:prerequisites 下载失败与 preflight 依赖。 网络受限环境下,ops -update 克隆 tasks 成功但 11 个 prerequisites 全部报 error in prereq X: failed to download(7zz 2407、coreutils 0.0.27、bun 1.3.14、kubectl 1.33.1、kind 0.30.0、k3sup 0.13.13、rg 14.1.0、uv 0.7.19、yq 4.47.1、helm 3.18.0、zip 3.0-1)。配置代理环境变量(http_proxy/https_proxy)重跑后,preflight 检查依次暴露缺失依赖:

failed preflight check: curl not installed but is required

安装 curl 后再次提示:

failed preflight check: ssh not installed but is required

一次性装齐三个运行时依赖再初始化最省事:

apt-get install -y git curl openssh-client
export http_proxy=http://<代理地址>:<端口> https_proxy=http://<代理地址>:<端口>
ops -update

(代理地址按自身网络环境填写;可直连外网的服务器无需设置代理变量。)

curl 与 ssh 齐备后,ops -update 全部 prerequisites 下载成功、无 error、退出码 0。结论:ops 在干净服务器初始化需要 git(克隆 tasks)、curl、ssh 与外网连通(或代理);prerequisites 包含 kubectl/kind/k3sup/helm 等,印证平台管理形态围绕 Kubernetes。

5.2 ops -help:命令体系总览

ops -help 完整实测原文(单破折号 docopt 风格):

Welcome to ops, the all-mighty, extensibile apache OPenServerless CLI Tool.
General syntax:
   ops -<tool>  <args>...
   ops <task>   <args>...
Essential tools (chek -h and -t for more):
-h | -help    list tools      (embedded tools, prefixed by '-', no download)
-v | -version current version (always mention this when asking for help)
-t | -tasks   list tasks      (show top level tasks, download if needed)
-i | -info    CLI infos       (show the cli environment)
-u | -update  download latest (get the latest tasks and prerequisites)
-c | -config  manage config   (openserverless server configuration)
-l | -login   access system   (required to access openserverless)
-reset        clean downloads (if nothing works, try this)
-reset clean  clean tasks     (remove tasks and tmp, keep prerequisites)

Tools (use -<tool> -h for help):
-awk
-base64
-config
-datefmt
-die
-echoif
-echoifempty
-echoifexists
-empty
-envsubst
-executable
-extract
-filetype
-gron
-info
-jj
-jq
-login
-needupdate
-opspath
-plugin
-random
-remove
-rename
-replace
-reset
-retry
-serve
-sh
-task
-update
-urlenc
-validate
-wsk

结构解读:ops 的命令分两类——以 - 前缀的内嵌工具(无需下载,含 -jq/-jj/-gron 等实用数据处理小工具与 -wsk OpenWhisk 桥接工具)与不带前缀的任务(tasks,按需从 tasks 仓库下载执行)。

5.3 ops -info:运行环境信息

初始化完成后 ops -info 实测输出:

OPS & OPS_CMD: /usr/local/bin/ops
OPS_VERSION: 0.9.0-incubating+26i11g51-snapshot
OPS_BRANCH: 0.9.0
OPS_BIN: /root/.ops/linux-amd64/bin
OPS_TMP: /root/.ops/tmp
OPS_HOME: /root/.ops
OPS_ROOT: /root/.ops/0.9.0/oplugins
OPS_REPO: https://github.com/apache/openserverless-task
OPS_PWD: /
OPS_TASKS: 7981be97d0b8df4fa7453ff493b3cb65c4117ebf
OPS_ROOT_PLUGIN: /

关键项:OPS_VERSION 与 4.3 节安装版本一致;OPS_REPO 指向 tasks 仓(任务实际执行体);OPS_TASKS 是已克隆 tasks 的 commit(7981be97d0b8df4fa7453ff493b3cb65c4117ebf),排障时可核对是否更新到位。

5.4 ops -t:顶层任务列表

ops -t(list tasks)完整实测输出:

*****
Tasks
*****

Type ops <task> to see usage and subtasks.

-----------------------------------
OpenServerless Administration Tasks
-----------------------------------

 admin       Manage additional users in OpenServerless
 config      Manage the Apache OpenServerless configuration
 setup       Setup the Apache OpenServerless platform on multiple environments
 debug       Debug utilities for the Apache OpenServerless platform
 cloud       OpenServerless setup utilities for supported Deployment models on Cloud Providers
 util        Utilities

--------------------------------
OpenServerless Development Tasks
--------------------------------

 ide         OpenServerless Development Utilities

---------------
OpenWhisk Tasks
---------------

 action      Manage actions
 invoke      Invoke an action (pass parameters with <key>=<value>)
 url         Get the url of an action
 activations Manage activations
 logs        Show logs of activations
 result      Show results of activations
 package     Manage packages
 trigger     Manage triggers

三组任务即平台的三大能力面:管理(admin/config/setup/debug/cloud)、开发(ide)、OpenWhisk 函数操作(action/invoke/url/activations/logs/result/package/trigger)。

六、部署形态与资源要求(以官方文档为准)

6.1 四种部署形态对照

官方 quickstart 给出四种部署形态及最低资源要求(来源:/docs/installation/quickstart/,2026-10-15 实测抓取):

形态命令官方前提 / 最低资源
本地工作站(推荐起步)ops setup miniDocker Desktop;16GB 内存 + 60GB 空闲磁盘;可用 PREFL_NO_MEM_CHECK=1、PLEFL_NO_CPU_CHECK=1 绕过内存/CPU 检查(官方注明会低效);装完经 http://devel.miniops.me 访问,属单机 Docker 编排的 slim 本地安装
本地 devclusterops setup devclusterDocker Desktop 至少 6GB 内存
Linux 服务器ops setup server <server> [<user>]8GB 内存 + 50GB 磁盘;ssh 免密登录 + sudo 免密(默认用户 root);放行 80/443/6443 端口;服务器上不得预装 Docker/K8s/Web server;安装器经 k3sup 自动安装 K3S
已有 Kubernetes 集群ops setup cluster [<context>]cluster-admin 权限;默认 StorageClass 为块存储;已安装 nginx-ingress;知道 ingress IP
云上拉起集群ops config eks/aks/gke + ops cloud eks/aks/gke createAWS EKS / Azure AKS / Google GKE
状态查看 / 卸载ops setup status / ops setup uninstall—

选型解读:第一次体验选 mini(资源够时)或 devcluster(资源紧张时);给自己可控的服务器则 setup server 一条命令拉起含 K3S 的完整平台;企业已有集群/云账号走 cluster/云形态。四形态的共同点是最终都落在 Kubernetes 上(mini/devcluster 的单机形态同样依赖 Docker Desktop 提供的编排能力),符合"runs in every Kubernetes"的项目定位。

6.2 ops setup 用法原文

ops setup 帮助完整实测原文(部署形态的权威用法口径):

***************
Tasks ops setup
***************

Manage installation

--------
Synopsis
--------

Usage:
 setup mini [<apihost>]
 setup devcluster [--uninstall|--status|[--skip-check-ports] [--skip-preload-images]]
 setup cluster [<context>] [--uninstall|--status]
 setup server <server> [<user>] [--uninstall|--status]
 setup status
 setup uninstall

--------
Commands
--------

 setup mini          deploy mini Apache OpenServerless, slim local installation available as http://devel.miniops.me (or your local domain)
 setup cluster       deploy Apache OpenServerless in the Kubernetes cluster using the <context>, default the current
 setup devcluster    deploy Apache OpenServerless in a devcluster created locally
                     you need Docker Desktop available with at least 6G of memory assigned
 setup server        create a Kubernetes in server <server> and deploy Apache OpenServerless
                     the server must be accessible with ssh using the <user> with sudo power, default root
 setup status        show the status of the last installation
 setup uninstall     uninstall the last installation

-------
Options
-------

 --uninstall           execute an uninstall instead of an installation
 --status              show the status instead of an installation
 --skip-check-ports    skip the check of already used ports
 --skip-preload-images skip the preload images step

--------
Subtasks
--------

* kubernetes : prepare kubernetes
* openserverless : install openserverless
* docker : prepare docker

帮助原文与 6.1 表互相印证;<apihost>/<server>/<user>/<context> 为官方原文的占位形式,按各自部署环境取值。

6.3 本文实测边界与下一步路径

⚠️ 诚实边界:截至成稿(2026-10-15),本文仅完成 ops CLI 的下载、安装与帮助体系实测(第四、五章),未执行 ops setup mini/devcluster/server/cluster 任何完整部署——官方本地 mini 模式要求 16GB 内存 + 60GB 磁盘、devcluster 要求 Docker Desktop 6GB 内存,当前实测环境不满足这些官方资源前提。部署环节的组件拓扑、耗时、检查项均以官方文档为准,本文不做转述性"实测"结论。

如需继续部署实操,推荐路径:阅读官方 Quick Start(参考链接)→ 按第六章表格准备满足资源要求的形态 → ops setup mini 起步 → 部署成功后用 ops -l 登录、ops action 部署第一个函数(第七章)。孵化期 API 与安装流程可能随 RC 迭代调整,动手前核对所用版本的官方文档。

七、与 OpenWhisk 的关系及使用视角

7.1 血统与模型沿用

官方定位原文已明确:"With Apache OpenWhisk as its FaaS engine"——OpenServerless 不重造 FaaS 内核,而是原样沿用 OpenWhisk 的 action 模型:函数打包为 action,经 trigger/rule 组织事件流,按 package 组织命名空间,每次调用产生 activation(含日志与结果)。OpenServerless 在其上补齐平台层:operator 管理数据与存储服务、ops 统一入口、IDE 集成与 starter 应用。

从 ops CLI 也能直接看到这层关系:ops -t 输出的 OpenWhisk Tasks 组(action/invoke/url/activations/logs/result/package/trigger,5.4 节实测)就是 OpenWhisk 原生 wsk 命令集的 ops 内嵌版——会 OpenWhisk 就几乎零成本上手 OpenServerless 的函数操作。

7.2 函数开发视角速览

以 ops 的任务形态,日常函数操作路径为:

ops action create demo/hello hello.js     # 创建 action(示例形式,具体以 ops action -h 为准)
ops action invoke demo/hello              # 调用 action(可传 <key>=<value> 参数,见 5.4 节 invoke 原文)
ops activations list                      # 查看激活列表
ops logs <activation-id>                  # 查看激活日志
ops result <activation-id>                # 查看激活结果
ops url demo/hello                        # 获取 action 的访问 URL

(以上为任务语义速览;各任务的完整参数以 ops <task> 无参输出为准——CLI 会打印该任务的 usage,与 5.4 节 Type ops <task> to see usage and subtasks. 的提示一致。)

💡 说明:action 代码按 OpenWhisk 运行时规范编写(入口为 main 函数),官方参考文档中的运行时章节即派生自 OpenWhisk 官方文档;语言支持与打包细节以所用版本官方文档为准。

八、适用场景与同类对比

适用场景:需要在自有 Kubernetes 上获得"函数计算 + 配套数据服务"一体化体验、且在意云厂商锁定的团队;已熟悉 OpenWhisk、想要更完整开发工具链(CLI/IDE/starter)的使用者;对 SQL/NoSQL/对象存储/LLM 服务有平台化纳管诉求的 Serverless 应用。

不适用/需谨慎:需要 ASF 完全背书与稳定正式版本的生产采购(仍在孵化、无正式 release);只想裸用函数引擎、不需要平台配套服务的极简场景。

💡 技术拓展:Kubernetes 生态的 FaaS/Serverless 方案横向对比——

方案特点适用场景
OpenWhisk(OpenServerless 内核)成熟 action 模型、多语言运行时、自带 activation/日志体系想要 FaaS + 平台化配套服务的完整体验
Knative Serving/EventingK8s 原生、缩容到零、与 Istio 等服务网格生态绑定已有较重 K8s 平台与网格设施的团队
OpenFaaS轻量、上手快、单机友好小规模函数计算、边缘与资源受限环境

OpenServerless 的选择即官方定位原文:以 Apache OpenWhisk 为 FaaS 引擎(Knative/OpenFaaS 仅作选型对照,本文未实测)。

九、参考链接