- 概述
- 要求
- 预安装
- 安装
- 安装后
- 迁移和升级
- 监控和警示
- 集群管理
- 特定于产品的配置
- 故障排除
使用集群角色授予安装权限
向 Automation Suite 安装程序服务帐户和集群管理员用户授予集群范围的 ClusterRole 和 ClusterRoleBinding 权限,以进行 OpenShift 安装。
仅当您无法为 Automation Suite 安装程序提供管理员权限时,安装权限才有意义。 如果您可以为安装程序提供所需的管理员权限,则无需遵循本部分中的说明。
此页面假设您可以向 Automation Suite 安装程序服务帐户 (uipathadmin) 授予集群范围的权限(ClusterRole 和 ClusterRoleBinding)。如果您的安全策略禁止授予任何集群范围的权限,请参阅“在无需集群角色的情况下授予安装权限” 。
如果您在同一集群上安装多个 Automation Suite 实例,则必须为在其中安装 Automation Suite 的其他命名空间授予权限。
Automation Suite 依赖于安装过程中的特定权限。 这些权限已分配给服务帐户,该帐户在安装各种 Automation Suite 组件时发挥着关键作用。
要配置安装所需的所有权限,请执行本部分中的步骤。
您必须在有权访问 OpenShift Kubernetes API 服务器的 Linux、Windows 或 macOS 计算机上执行本节中引用的命令。
步骤 1:创建服务帐户
要创建服务帐户,请执行以下步骤:
-
创建
<uipath>命名空间和项目:oc get namespace <uipath> || oc new-project <uipath>oc get namespace <uipath> || oc new-project <uipath> -
将默认命名空间和项目设置为
<uipath>:oc project <uipath>oc project <uipath>所有后续
oc命令都将在<uipath>命名空间中运行。 -
创建一个名为
uipathadmin的服务帐户:oc create serviceaccount uipathadminoc create serviceaccount uipathadmin -
使用现有的
admin集群角色向<uipath>命名空间中的uipathadmin服务帐户授予管理员权限:oc create rolebinding uipathadmin --clusterrole=admin --serviceaccount=<uipath>:uipathadminoc create rolebinding uipathadmin --clusterrole=admin --serviceaccount=<uipath>:uipathadmin
步骤 2:创建所需的角色
在 Automation Suite 安装期间,uipathadmin 服务帐户需要某些权限。您可以通过创建角色来提供必要的权限。
要创建每个角色,请将其配置保存为 YAML 文件,然后运行以下命令,并将 <file_name.yaml> 占位符替换为 YAML 文件的实际名称:
oc apply -f <file_name.yaml>
oc apply -f <file_name.yaml>
您可以通过复制以下部分中的配置来为每个角色创建 YAML 文件。
查询命名空间 [只读]
用于检查命名空间(如<istio-system>命名空间)是否可用。
以下示例显示了 namespace-reader-clusterrole 配置:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: namespace-reader-clusterrole
rules:
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["get"]
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: namespace-reader-clusterrole
rules:
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["get"]
列出节点和 CRD [只读]
先决条件检查和诊断运行状况检查工具需要此权限来执行节点验证,例如节点上的可用容量。
以下示例显示了 list-nodes-and-crd-clusterrole 配置:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: list-nodes-and-crd-clusterrole
rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["list", "get"]
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["list"]
- apiGroups: ["metrics.k8s.io"]
resources: ["nodes"]
verbs: ["list", "get"]
- apiGroups: ["scheduling.k8s.io"]
resources: ["priorityclasses"]
verbs: ["get"]
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: list-nodes-and-crd-clusterrole
rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["list", "get"]
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["list"]
- apiGroups: ["metrics.k8s.io"]
resources: ["nodes"]
verbs: ["list", "get"]
- apiGroups: ["scheduling.k8s.io"]
resources: ["priorityclasses"]
verbs: ["get"]
如果这些权限在您的集群中不可用,Automation Suite Robot 无法自动确定最大并发作业数。要显式定义限制,请在 concurrency_limit 的 asrobots 部分中配置 input.json。有关详细信息,请参阅Automation Suite Robot 特定配置。
uipath 角色 [write]
大多数 Automation Suite 安装都是通过 ArgoCD 执行的;但是,某些组件的安装是通过 Helm 图表执行的。
uipathctl工具运行安装作业,以执行 Helm 图表的安装。 连接到kube-api-server并在<uipath>命名空间中安装 Helm 图表,需要命名空间级别的角色创建者角色。
以下示例显示了 uipath-automationsuite-role 配置:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: uipath-automationsuite-role
namespace: <uipath>
rules:
- apiGroups: ["rbac.authorization.k8s.io"]
resources: ["roles", "rolebindings"]
verbs: ["get", "watch", "list", "patch", "update", "create"]
- apiGroups: [""]
resources: ["secrets", "configmaps"]
verbs: ["get", "watch", "list", "patch", "update", "create"]
- apiGroups: ["security.istio.io", "networking.istio.io"]
resources: ["*"]
verbs: ["get", "watch", "list", "patch", "update", "create", "delete"]
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: uipath-automationsuite-role
namespace: <uipath>
rules:
- apiGroups: ["rbac.authorization.k8s.io"]
resources: ["roles", "rolebindings"]
verbs: ["get", "watch", "list", "patch", "update", "create"]
- apiGroups: [""]
resources: ["secrets", "configmaps"]
verbs: ["get", "watch", "list", "patch", "update", "create"]
- apiGroups: ["security.istio.io", "networking.istio.io"]
resources: ["*"]
verbs: ["get", "watch", "list", "patch", "update", "create", "delete"]
<istio-system> 角色 [write]
仅当您希望安装程序配置 WebAssembly (WASM) 插件时,请提供这些权限。否则,不提供权限。
在<istio-system>命名空间中执行以下操作:
- Automation Suite 先决条件检查工具会读取
<istio-system>命名空间中的 Pod 和服务,以验证是否已正确安装和配置 Istio。 - Automation Suite 会在
<istio-system>命名空间中安装 WASM 插件以配置基于路径的路由规则,使用uipathctl运行基于 Helm 的安装作业。这需要创建一个imagepullsecret以从注册表中拉取映像,以及<istio-system>命名空间的角色创建者。
以下示例显示了 istio-system-automationsuite-role 配置:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: istio-system-automationsuite-role
namespace: <istio-system>
rules:
- apiGroups: [""]
resources: ["services", "pods"]
verbs: ["list"]
- apiGroups: ["rbac.authorization.k8s.io"]
resources: ["roles", "rolebindings"]
verbs: ["*"]
- apiGroups: ["*"]
resources: ["secrets", "configmaps"]
verbs: ["get", "watch", "list", "patch", "update", "create"]
- apiGroups: ["networking.istio.io", "extensions.istio.io"]
resources: ["*"]
verbs: ["*"]
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: istio-system-automationsuite-role
namespace: <istio-system>
rules:
- apiGroups: [""]
resources: ["services", "pods"]
verbs: ["list"]
- apiGroups: ["rbac.authorization.k8s.io"]
resources: ["roles", "rolebindings"]
verbs: ["*"]
- apiGroups: ["*"]
resources: ["secrets", "configmaps"]
verbs: ["get", "watch", "list", "patch", "update", "create"]
- apiGroups: ["networking.istio.io", "extensions.istio.io"]
resources: ["*"]
verbs: ["*"]
<istio-system> 角色 [只读]
如果您已配置 Istio 并安装了 WASM 插件,请提供这些权限。
在<istio-system>命名空间中执行以下操作:
- Automation Suite 先决条件检查工具会读取
<istio-system>命名空间中的 Pod 和服务,以验证是否已正确安装和配置 Istio。 - 需要
get secrets权限才能将证书文件从<istio-system>命名空间复制到<uipath>命名空间。
以下示例显示了 istio-system-automationsuite-role 配置:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: istio-system-automationsuite-role
namespace: <istio-system>
rules:
- apiGroups: [""]
resources: ["services", "pods"]
verbs: ["list"]
- apiGroups: ["*"]
resources: ["secrets"]
resourceNames: ["istio-ingressgateway-certs"]
verbs: ["get"]
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: istio-system-automationsuite-role
namespace: <istio-system>
rules:
- apiGroups: [""]
resources: ["services", "pods"]
verbs: ["list"]
- apiGroups: ["*"]
resources: ["secrets"]
resourceNames: ["istio-ingressgateway-certs"]
verbs: ["get"]
步骤 3:绑定角色
您必须通过运行以下命令,将上一步中创建的角色绑定到uipathadmin服务帐户:
oc project <istio-system>
oc create rolebinding istio-system-automationsuite-rolebinding \
--role=istio-system-automationsuite-role --serviceaccount=<uipath>:uipathadmin
oc create rolebinding namespace-reader-rolebinding \
--clusterrole=namespace-reader-clusterrole --serviceaccount=<uipath>:uipathadmin
oc project <uipath>
oc create clusterrolebinding list-nodes-and-crd-rolebinding \
--clusterrole=list-nodes-and-crd-clusterrole --serviceaccount=<uipath>:uipathadmin
oc create rolebinding uipath-automationsuite-rolebinding \
--role=uipath-automationsuite-role --serviceaccount=<uipath>:uipathadmin
# This step is needed only if you want the installer to configure the WASM Plugin. Otherwise skip it.
oc -n <istio-system> create rolebinding uipadmin-istio-system \
--clusterrole=admin --serviceaccount=<uipath>:uipathadmin
oc project <istio-system>
oc create rolebinding istio-system-automationsuite-rolebinding \
--role=istio-system-automationsuite-role --serviceaccount=<uipath>:uipathadmin
oc create rolebinding namespace-reader-rolebinding \
--clusterrole=namespace-reader-clusterrole --serviceaccount=<uipath>:uipathadmin
oc project <uipath>
oc create clusterrolebinding list-nodes-and-crd-rolebinding \
--clusterrole=list-nodes-and-crd-clusterrole --serviceaccount=<uipath>:uipathadmin
oc create rolebinding uipath-automationsuite-rolebinding \
--role=uipath-automationsuite-role --serviceaccount=<uipath>:uipathadmin
# This step is needed only if you want the installer to configure the WASM Plugin. Otherwise skip it.
oc -n <istio-system> create rolebinding uipadmin-istio-system \
--clusterrole=admin --serviceaccount=<uipath>:uipathadmin
步骤 4:生成 kubeconfig 文件
将所有权限分配给服务帐户后,必须创建一个kubeconfig文件,以传递给uipathctl工具进行安装。
在 Linux 或 Mac 上生成 kubeconfig 文件
要在 Linux 或 Mac 上生成kubeconfig文件,请运行以下命令:
# For generating kubeconfig
# Creates the token for uipathadmin service account
token=$(oc -n <uipath> create token uipathadmin --duration=8760h)
# Getting api-server details
server=$(oc config view -o jsonpath="{.clusters[]..server}")
# Login logs on using the provided token and server and outputs kubeconfig at the provided path.
oc login --server=$server --token=$token --kubeconfig=uipathadminkubeconfig --insecure-skip-tls-verify=true
# For generating kubeconfig
# Creates the token for uipathadmin service account
token=$(oc -n <uipath> create token uipathadmin --duration=8760h)
# Getting api-server details
server=$(oc config view -o jsonpath="{.clusters[]..server}")
# Login logs on using the provided token and server and outputs kubeconfig at the provided path.
oc login --server=$server --token=$token --kubeconfig=uipathadminkubeconfig --insecure-skip-tls-verify=true
如果操作成功,您应该会看到一个名为uipathadminkubeconfig的kubeconfig文件。
在 Windows 上生成 kubeconfig 文件
您必须使用 Windows Powershell 执行此步骤。
要在 Windows 上生成 kubeconfig 文件,请运行以下命令:
# For generating kubeconfig
# Creates the token for uipathadmin service account
$token = oc -n <uipath> create token uipathadmin --duration=8760h
# Getting api-server details
$server = oc config view -o jsonpath="{.clusters[]..server}"
# Login logs on using the provided token and server and outputs kubeconfig at the provided path.
oc login --server=$server --token=$token --kubeconfig=uipathadminkubeconfig --insecure-skip-tls-verify=true
# For generating kubeconfig
# Creates the token for uipathadmin service account
$token = oc -n <uipath> create token uipathadmin --duration=8760h
# Getting api-server details
$server = oc config view -o jsonpath="{.clusters[]..server}"
# Login logs on using the provided token and server and outputs kubeconfig at the provided path.
oc login --server=$server --token=$token --kubeconfig=uipathadminkubeconfig --insecure-skip-tls-verify=true
如果操作成功,您应该会在kubeconfig uipathadminkubeconfigtemp文件夹中看到一个名为 的 文件。
步骤 5:使用生成的 kubeconfig 文件
您必须使用 uipathadminkubeconfig 文件执行此工作流中的所有后续 uipathctl 命令,包括先决条件检查、安装和运行状况检查。否则,uipathctl 将回退到默认的 kubeconfig 文件,该文件可能使用 cluster-admin 权限而不是受限的 uipathadmin 服务帐户进行身份验证。
有关如何指定 kubeconfig 文件的详细信息,请参阅指定 kubeconfig 文件。