9.3. 故障排除权限失败

如果因为缺少权限而导致 Operator 安装失败,请按照以下流程找出错误。

流程

  1. 查看订阅对象。其状态中有一个指向 InstallPlan 对象的对象引用 installPlanRef,该对象试图为 Operator 创建必要的 [Cluster]Role[Binding]:

    apiVersion: operators.coreos.com/v1
    kind: Subscription
    metadata:
      name: etcd
      namespace: scoped
    status:
      installPlanRef:
        apiVersion: operators.coreos.com/v1
        kind: InstallPlan
        name: install-4plp8
        namespace: scoped
        resourceVersion: "117359"
        uid: 2c1df80e-afea-11e9-bce3-5254009c9c23
  2. 检查 InstallPlan 对象的状态,了解出现的任何错误:

    apiVersion: operators.coreos.com/v1
    kind: InstallPlan
    status:
      conditions:
      - lastTransitionTime: "2019-07-26T21:13:10Z"
        lastUpdateTime: "2019-07-26T21:13:10Z"
        message: 'error creating clusterrole etcdoperator.v0.9.4-clusterwide-dsfx4: clusterroles.rbac.authorization.k8s.io
          is forbidden: User "system:serviceaccount:scoped:scoped" cannot create resource
          "clusterroles" in API group "rbac.authorization.k8s.io" at the cluster scope'
        reason: InstallComponentFailed
        status: "False"
        type: Installed
      phase: Failed

    错误信息中会显示:

    • 创建失败的资源类型,包括资源的 API 组。本例中为 rbac.authorization.k8s.io 组中的 clusterroles
    • 资源名称。
    • 错误类型:is forbidden 表明相应用户没有足够权限来执行这一操作。
    • 试图创建或更新资源的用户名称。本例中指的是 OperatorGroup 中指定的服务账户。
    • 操作范围:集群范围内或范围外。

      用户可在服务账户中增加所缺权限,然后迭代操作。

      注意

      OLM 目前未提供首次尝试的完整错误列表,但可能会在后续版本中增加。