Loading...
Loading...
Compare original and translation side by side
percli projectpercli project| Symptom | Cause | Fix |
|---|---|---|
| "already exists" / 409 Conflict | Project name is already taken | List existing projects with |
| "invalid name" / 400 Bad Request | Project name contains invalid characters (uppercase, spaces, special chars) | Use lowercase alphanumeric names with hyphens only (e.g., |
| "unauthorized" / 401 | Not authenticated or session token expired | Run |
| "forbidden" / 403 | Authenticated user lacks permission to create projects | User needs a GlobalRole with |
| 症状 | 原因 | 解决方法 |
|---|---|---|
| "already exists" / 409 Conflict | 项目名称已被占用 | 使用 |
| "invalid name" / 400 Bad Request | 项目名称包含无效字符(大写、空格、特殊字符) | 仅使用小写字母数字和连字符(例如: |
| "unauthorized" / 401 | 未认证或会话令牌过期 | 先运行 |
| "forbidden" / 403 | 已认证用户缺少创建项目的权限 | 用户需要具有Project范围 |
| Symptom | Cause | Fix |
|---|---|---|
| "role not found" in RoleBinding apply | The role referenced in | Create the Role first, then create the RoleBinding. Verify role exists with |
| "subject not found" / binding has no effect | User or group name in subjects does not match any identity in the auth provider | Verify user identity with the configured auth provider (Native, OIDC, OAuth). For native auth, the username is the login name |
| "project not found" in role metadata | The project specified in | Create the project first, or fix the project name in the role definition |
| GlobalRole apply returns 403 | User does not have cluster-level admin permissions | GlobalRole and GlobalRoleBinding require admin-level access; escalate to a Perses admin |
| 症状 | 原因 | 解决方法 |
|---|---|---|
| RoleBinding应用时出现"role not found" | | 先创建Role,再创建RoleBinding。使用 |
| "subject not found" / 绑定无效果 | 主体中的用户或组名称与认证提供商中的任何身份不匹配 | 与配置的认证提供商(Native、OIDC、OAuth)验证用户身份。对于原生认证,用户名是登录名 |
| 角色元数据中出现"project not found" | | 先创建项目,或修正角色定义中的项目名称 |
| 应用GlobalRole返回403 | 用户缺少集群级管理员权限 | GlobalRole和GlobalRoleBinding需要管理员级访问权限;请联系Perses管理员提升权限 |
| Symptom | Cause | Fix |
|---|---|---|
| Resources appear in wrong project | | Always run |
| "project not set" error | No active project context configured | Run |
| Role/binding created but permissions don't work | RoleBinding references a role from a different project | Ensure role and binding are in the same project; check |
| 症状 | 原因 | 解决方法 |
|---|---|---|
| 资源出现在错误的项目中 | | 在应用项目范围的资源之前,始终立即运行 |
| "project not set"错误 | 未配置活动项目上下文 | 运行 |
| 角色/绑定已创建但权限不生效 | RoleBinding引用了其他项目的角色 | 确保角色和绑定在同一个项目中;检查两者的 |
| Symptom | Cause | Fix |
|---|---|---|
| Perses server has | Ask user to disable read-only mode, or switch to a writable instance |
| MCP tool returns connection refused | MCP server cannot reach Perses API | Check MCP server config URL and ensure Perses server is running at that address |
| MCP list returns empty but projects exist | MCP auth credentials lack read permission | Verify MCP server auth config; the configured user needs at least read access |
| 症状 | 原因 | 解决方法 |
|---|---|---|
| Perses服务器配置中 | 请用户禁用只读模式,或切换到可写实例 |
| MCP工具返回连接拒绝 | MCP服务器无法连接到Perses API | 检查MCP服务器配置URL,确保Perses服务器在该地址运行 |
| MCP列表返回空但项目实际存在 | MCP认证凭据缺少读权限 | 验证MCP服务器认证配置;配置的用户至少需要读访问权限 |
| Anti-Pattern | Why It Fails | Correct Approach |
|---|---|---|
| Creating projects without RBAC in production — skipping role and binding setup | Any authenticated user gets full read/write/delete access to the project's resources | Always create at least a viewer role and an admin role with bindings for production projects |
| Not setting active project before applying resources — relying on "whatever was last set" | Resources silently apply to the wrong project; no error is raised | Run |
| Using GlobalRole for project-scoped permissions — granting org-wide access when project-level suffices | Violates principle of least privilege; users get access to all projects instead of just one | Use project-scoped Role for project-specific permissions; reserve GlobalRole for truly organization-wide needs |
| Creating RoleBindings without verifying the role exists — assuming role was created in a prior step | Binding references a non-existent role; no permissions are granted; no error may surface until access is denied | Always verify role existence with |
| Deleting a project without checking for active dashboards — removing a project that contains resources | All dashboards, datasources, variables, and other resources in the project are permanently deleted | List project contents with |
| 反模式 | 失败原因 | 正确做法 |
|---|---|---|
| 生产环境中创建项目不配置RBAC — 跳过角色和绑定设置 | 任何已认证用户都可以对项目资源进行完全的读/写/删除操作 | 对于生产项目,始终至少创建一个查看者角色和一个管理员角色并配置绑定 |
| 应用资源前不设置活动项目 — 依赖“上次设置的项目” | 资源被静默应用到错误的项目;不会引发错误 | 在每次应用项目范围资源的 |
| 使用GlobalRole实现项目范围权限 — 需要项目级权限时授予全组织访问权限 | 违反最小权限原则;用户将获得所有项目的访问权限,而不仅仅是一个 | 对项目特定权限使用项目范围的Role;仅在确实需要全组织范围权限时使用GlobalRole |
| 不验证角色是否存在就创建RoleBindings — 假设角色已在之前的步骤中创建 | 绑定引用不存在的角色;不会授予权限;直到访问被拒绝时才会发现问题 | 在创建绑定之前,始终使用 |
| 不检查活动仪表板就删除项目 — 删除包含资源的项目 | 项目中的所有仪表板、数据源、变量和其他资源将被永久删除 | 删除前使用 |
| Rationalization | Why It's Wrong | Required Action |
|---|---|---|
| "The project was just created, RBAC can wait" | In the gap between creation and RBAC setup, any authenticated user has full access to the project | Set up RBAC immediately after project creation for production environments |
| "I already set the project context earlier" | Context may have changed if other commands ran between setting it and applying resources | Re-run |
| "The role name looks right, skip the verify step" | Typos in role names fail silently in RoleBindings — the binding is created but grants nothing | Run |
| "GlobalRole is simpler than per-project roles" | Simpler setup, but violates least-privilege and gives access across every project | Use project-scoped Roles unless the permission genuinely needs to span all projects |
| "MCP created it so it must exist" | MCP tool may return success on a stale or cached response; network issues can cause partial creates | Verify with a list or describe command after every create operation |
| 错误借口 | 错误原因 | 必要操作 |
|---|---|---|
| "项目刚创建,RBAC可以稍后再配置" | 在创建和RBAC设置之间的空档期,任何已认证用户都拥有项目的完全访问权限 | 生产环境中创建项目后立即配置RBAC |
| "我之前已经设置过项目上下文了" | 如果在设置和应用资源之间运行了其他命令,上下文可能已更改 | 每次应用前重新运行 |
| "角色名称看起来正确,跳过验证步骤" | 角色名称中的拼写错误会导致RoleBindings静默失败 — 绑定会被创建但不授予任何权限 | 创建绑定前运行 |
| "GlobalRole比每个项目单独配置Role更简单" | 设置更简单,但违反最小权限原则,会授予用户所有项目的访问权限 | 使用项目范围的Role 除非权限确实需要覆盖所有项目 |
| "MCP创建了它,所以它肯定存在" | MCP工具可能返回缓存的成功响应;网络问题可能导致部分创建失败 | 每次创建操作后 使用列表或描述命令验证 |
"*""*"kindkindpercli apply -f - <<EOF
kind: Project
metadata:
name: <project-name>
spec: {}
EOFpercli apply -f - <<EOF
kind: Project
metadata:
name: <project-name>
spec: {}
EOF
**Via MCP** (preferred):
**Gate**: Project created and set as active context. Proceed to Phase 2 if RBAC is needed, otherwise task complete.
**通过MCP**(优先):
**检查点**:项目已创建并设置为活动上下文。如果需要RBAC,继续到阶段2,否则任务完成。percli apply -f - <<EOF
kind: Role
metadata:
name: dashboard-editor
project: <project-name>
spec:
permissions:
- actions: [read, create, update]
scopes: [Dashboard, Datasource, Variable]
EOFpercli apply -f - <<EOF
kind: GlobalRole
metadata:
name: org-viewer
spec:
permissions:
- actions: [read]
scopes: ["*"]
EOFpercli apply -f - <<EOF
kind: RoleBinding
metadata:
name: team-editors
project: <project-name>
spec:
role: dashboard-editor
subjects:
- kind: User
name: user@example.com
EOFpercli apply -f - <<EOF
kind: GlobalRoleBinding
metadata:
name: org-viewers
spec:
role: org-viewer
subjects:
- kind: User
name: viewer@example.com
EOFpercli apply -f - <<EOF
kind: Role
metadata:
name: dashboard-editor
project: <project-name>
spec:
permissions:
- actions: [read, create, update]
scopes: [Dashboard, Datasource, Variable]
EOFpercli apply -f - <<EOF
kind: GlobalRole
metadata:
name: org-viewer
spec:
permissions:
- actions: [read]
scopes: ["*"]
EOFpercli apply -f - <<EOF
kind: RoleBinding
metadata:
name: team-editors
project: <project-name>
spec:
role: dashboard-editor
subjects:
- kind: User
name: user@example.com
EOFpercli apply -f - <<EOF
kind: GlobalRoleBinding
metadata:
name: org-viewers
spec:
role: org-viewer
subjects:
- kind: User
name: viewer@example.com
EOFundefinedundefined
Or via MCP:
**Gate**: Project listed, roles and bindings confirmed. Task complete.
---
或通过MCP:
**检查点**:项目已列出,角色和绑定已确认。任务完成。
---| Resource | URL |
|---|---|
| Perses Project API docs | https://perses.dev/docs/api/project/ |
| Perses RBAC documentation | https://perses.dev/docs/user-guides/security/rbac/ |
| Perses Authentication docs | https://perses.dev/docs/user-guides/security/authentication/ |
| percli CLI reference | https://perses.dev/docs/user-guides/percli/ |
| Perses MCP server | https://github.com/perses/perses-mcp-server |
| Perses Operator (project-to-namespace mapping) | https://github.com/perses/perses-operator |
| 资源 | URL |
|---|---|
| Perses Project API文档 | https://perses.dev/docs/api/project/ |
| Perses RBAC文档 | https://perses.dev/docs/user-guides/security/rbac/ |
| Perses认证文档 | https://perses.dev/docs/user-guides/security/authentication/ |
| percli CLI参考 | https://perses.dev/docs/user-guides/percli/ |
| Perses MCP服务器 | https://github.com/perses/perses-mcp-server |
| Perses Operator(项目到Namespace的映射) | https://github.com/perses/perses-operator |