Skip to content

Admin 认证与 RBAC

最小 Admin Console 本地 Basic 登录示例(需显式配置;默认 auth 类型为 none)。

源码:examples/admin-auth/

开放模式(默认)

省略 admin.auth.type 时使用 none — 无登录页。示例:

yaml
version: v1
port: 8080

# Admin API/UI without login — local development only.
# Do not expose on untrusted networks.
admin:
  enabled: true
  port: 9080
  database:
    driver: sqlite
    dsn: file:./admin-open.db?cache=shared&_fk=1
  auth:
    type: none

rules:
  - host: app.example.com
    backend:
      service:
        name: app-service
        port: 8080

none 仅适合 localhost 或可信网络。生产环境请设置 basicoauth

Basic 登录(生产推荐)

yaml
version: v1
port: 8080

# Minimal Admin Console with local login + RBAC.
# Default UI login: admin / admin (see admin.auth.basic below).
admin:
  enabled: true
  port: 9080
  database:
    driver: sqlite
    dsn: file:./admin-auth.db?cache=shared&_fk=1
  auth:
    type: basic
    basic:
      username: admin
      password: admin

rules:
  - host: app.example.com
    backend:
      service:
        name: app-service
        port: 8080
Admin 地址http://127.0.0.1:9080
示例账号admin / admin(来自 admin.auth.basic
RBAC 数据库与本 YAML 同目录的 ./admin-auth.db

校验与运行

bash
ingress validate -c examples/admin-auth/ingress.yaml
ingress run -c examples/admin-auth/ingress.yaml

登录后在侧栏 权限 中管理用户、角色与权限。

相关文档

Released under the MIT License.