应用管理

nae quota

配额用量:CPU/内存/存储/应用数 的「已用 / 上限」。

nae quota
{
  "cpu_used": "300m",
  "cpu_limit": "2",
  "mem_used": "512Mi",
  "mem_limit": "4Gi",
  "storage_used": "2Gi",
  "storage_limit": "20Gi",
  "apps_used": 3,
  "apps_limit": 10
}

nae apps

列出应用。--all 仅管理员,查看全平台;普通用户恒看自己的。

nae apps

返回数组,每项为一个应用(下为关键字段,完整响应字段更多):

[
  {
    "ID": 42,
    "AppID": "myweb",
    "OwnerID": 8,
    "Kind": "normal",
    "Namespace": "tenant-8",
    "Status": "running",
    "Replicas": 1,
    "ContainerPort": 8080,
    "CPULimit": "500m",
    "MemLimit": "512Mi",
    "Route": "https://workshop.newbeebox.com/apps/myweb",
    "CreatedAt": "2026-06-22T10:00:00Z"
  }
]

nae app

应用详情 / 状态 / 设置。PendingConfig 列出改了但尚未重启生效的字段;StatusReason 仅在应用异常时出现(如镜像拉取失败、配额超限)。

nae app myweb
{
  "ID": 42,
  "AppID": "myweb",
  "Kind": "normal",
  "Status": "running",
  "Replicas": 1,
  "ContainerPort": 8080,
  "CPULimit": "500m",
  "MemLimit": "512Mi",
  "TrackedTag": "latest",
  "KeepPathPrefix": false,
  "Route": "https://workshop.newbeebox.com/apps/myweb",
  "PendingConfig": [],
  "CreatedAt": "2026-06-22T10:00:00Z"
}

nae children

子服务列表(如 Milvus 的 etcd/minio);非编排应用返回 []

nae children myvec
[
  { "ID": 51, "AppID": "myvec-etcd", "Component": "etcd", "Kind": "template", "Status": "running", "ParentAppID": "myvec" },
  { "ID": 52, "AppID": "myvec-minio", "Component": "minio", "Kind": "template", "Status": "running", "ParentAppID": "myvec" }
]

nae create

创建应用。选项:--app-id(必填) --kind(normal|template,默认 normal) --tag --port --cpu --mem --max-restarts --keep-path-prefix --internal-only --template --storage --replicas --env <json> --config <json> --owner <uid>(仅管理员代建)。nae create --help 末尾附完整示例。

普通应用:

nae create --app-id myweb --tag latest --port 8080 \
  --cpu 500m --mem 512Mi --env '{"FOO":"bar"}'
# 自带 basePath 的框架(如 Next.js Node server)加 --keep-path-prefix
# 仅内部访问(不导出外链,只在集群内被其它应用经 DNS+端口调用,如后端 API):
nae create --app-id myapi --tag latest --port 8080 --internal-only

--internal-only 让普通应用退化为模板式寻址:不建对外路由,Route 返回集群内 DNS <svc>.<ns>.svc.cluster.local:<port>(同命名空间内的其它应用据此互调)。它仍是普通应用—— 照常推镜像/轮询 tag/可重启,只是不出公网。此项创建后不可改(切换需建/删路由),需删除重建。

返回新建的应用对象(关键字段):

{
  "ID": 42,
  "AppID": "myweb",
  "Kind": "normal",
  "Status": "awaiting_image",
  "ContainerPort": 8080,
  "Route": "https://workshop.newbeebox.com/apps/myweb",
  "PushCN": "registry-d.newbeebox.com/app-image-xxxxxxxx",
  "PushGlobal": "registry-d.newbeebox.com/app-image-xxxxxxxx"
}

模板应用(密码仅此次返回一次):

nae create --kind template --app-id myredis \
  --template redis --storage 2Gi --config '{"password":"s3cret"}'
{
  "app": { "ID": 43, "AppID": "myredis", "Kind": "template", "Status": "created", "ContainerPort": 6379 },
  "password": "s3cret"
}

nae update

修改已建应用的配置,不必删库重建。读-改-写:只覆盖你传的字段,其余保持不变。 改后需 restart(运行中)或下次 start 才生效(见生命周期)。

nae update myweb --port 8080            # 改容器端口
nae update myweb --cpu 1 --mem 1Gi      # 改资源上限
nae update myweb --env-file env.json    # 整体替换环境变量(推荐,绕开 shell 引号)
nae update myweb --strip-path-prefix    # 切换路由前缀策略(或 --keep-path-prefix)
参数 说明
--port <n> 容器端口(仅普通应用)
--cpu <limit> / --mem <limit> 资源上限,如 1/500m512Mi/1Gi
--tag <tag> 跟踪的镜像 tag(仅普通应用)
--max-restarts <n> 失败重启上限,0=不封顶(仅普通应用)
--keep-path-prefix / --strip-path-prefix 切换是否剥离 /apps/<appid> 前缀(互斥,仅普通应用)
--env '<json>' / --env-file <path> 整体替换环境变量(仅普通应用;二选一,优先 --env-file

哪些能改、哪些不能

--env/--env-file整体替换不是增量合并:只想加一个键也要把现有的一并带上。 先 nae app <id> -o json 看当前 EnvJSON,改好再整体提交。

nae reset-password

重置模板应用的连接密码——不清空数据(当前支持 Redis/PostgreSQL;Milvus 不支持)。忘记密码时用它,数据卷原样保留。

nae reset-password mypg                       # 随机生成新密码并返回
nae reset-password myredis --password s3cret  # 指定新密码(可打印 ASCII,1-128 位)
{ "password": "<新明文密码>" }

新密码仅此次返回,请立即保存。PostgreSQL 需应用在运行中(经容器内本地连接改密);Redis 会自动滚动重启使新密码生效。

nae delete

删除应用(模板级联清子服务/PVC/secret),幂等。

nae delete myweb
{ "deleted": true }