UiPath Documentation
automation-suite
2.2510
true
OpenShift 上的 Automation Suite 安装指南
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。

在无集群角色的情况下授予安装权限

向 Automation Suite 安装程序授予对 OpenShift 命名空间范围的权限,并使用预创建的资源补偿缺失的集群范围角色。

重要提示:

仅当您的安全策略禁止向ClusterRole ClusterRoleBindingAutomation Suite 安装程序服务帐户 () 授予任何集群范围的权限( 或uipathadmin )时,此页面才适用。如果您可以授予集群范围的权限,请参阅“授予具有集群角色的安装权限” 。

如果您在同一集群上安装多个 Automation Suite 实例,则必须为在其中安装 Automation Suite 的其他命名空间授予权限。

本页介绍如何向 Automation Suite 安装程序授予其所需的权限,而无需分配任何集群范围的权限。

您可以将 uipathadmin 服务帐户严格保持在命名空间范围内:跳过两个集群范围内的 ClusterRole 资源和标准流中使用的 ClusterRoleBinding,并使用一组预配置文件来补偿缺少的集群范围读取。 - 创建的资源和 uipathctl 标志。

备注:

您必须在有权访问 OpenShift Kubernetes API 服务器的 Linux、Windows 或 macOS 计算机上执行本节中引用的命令。

执行管理员操作(创建证书 Secret)的命令必须由集群管理员运行。执行uipathadmin操作的命令使用您在步骤 4中生成的kubeconfig 。

要在没有集群角色的情况下授予安装权限,请执行以下步骤:

  1. 创建服务帐户
  2. 创建所需的命名空间作用域的角色
  3. 绑定角色
  4. 生成 kubeconfig 文件
  5. 为受限模式操作配置 input.json
  6. 预创建 TLS 证书密码
  7. 安装并配置服务网格和 GitOps 工具

步骤 1:创建服务帐户​

要创建服务帐户,请执行以下步骤:

  1. 创建<uipath>命名空间和项目:

    oc get namespace <uipath> || oc new-project <uipath>
    oc get namespace <uipath> || oc new-project <uipath>
    
  2. 将默认命名空间和项目设置为<uipath> :

    oc project <uipath>
    oc project <uipath>
    

    所有后续oc命令都将在<uipath>命名空间中运行。

  3. 创建一个名为uipathadmin的服务帐户:

    oc create serviceaccount uipathadmin
    oc create serviceaccount uipathadmin
    
  4. 使用现有的admin集群角色向<uipath>命名空间中的uipathadmin服务帐户授予管理员权限:

    oc create rolebinding uipathadmin --clusterrole=admin --serviceaccount=<uipath>:uipathadmin
    oc create rolebinding uipathadmin --clusterrole=admin --serviceaccount=<uipath>:uipathadmin
    
    备注:

    这是命名空间范围的 RoleBinding,引用内置 admin 集群角色。它仅在 uipathadmin 命名空间内授予 <uipath> 管理员权限,而不在集群范围内授予。未创建任何 ClusterRoleBinding。

步骤 2:创建所需的命名空间作用域的角色​

在 Automation Suite 安装期间,uipathadmin 服务帐户需要某些权限。在 no-cluster-roles 流程中,您仅通过命名空间作用域的角色提供这些权限。

要创建每个角色,请将其配置保存为 YAML 文件,然后运行以下命令,并将 <file_name.yaml> 占位符替换为 YAML 文件的实际名称:

oc apply -f <file_name.yaml>
oc apply -f <file_name.yaml>

您可以通过复制以下部分中的配置来为每个角色创建 YAML 文件。

以下命名空间作用域的角色是此流程中唯一需要的角色。uipathadmin原本依赖于集群范围读取的先决条件检查将被排除并在带外进行验证,如在不使用集群角色的情况下运行先决条件检查中所述。

<uipath>命名空间​中的安装权限

Automation Suite 安装的大多数部分都通过 ArgoCD 运行,但某些组件是直接通过 Helm 图表安装的。uipathctl 工具运行安装作业,该作业在 <uipath> 命名空间中执行这些 Helm 安装。为此,uipathadmin 需要命名空间作用域的角色,该角色可以创建和管理角色、角色绑定、密码和配置映射。

以下示例显示了 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", "delete"]
  - apiGroups: [""]
    resources: ["secrets", "configmaps"]
    verbs: ["get", "watch", "list", "patch", "update", "create", "delete"]
  - 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", "delete"]
  - apiGroups: [""]
    resources: ["secrets", "configmaps"]
    verbs: ["get", "watch", "list", "patch", "update", "create", "delete"]
  - apiGroups: ["security.istio.io", "networking.istio.io"]
    resources: ["*"]
    verbs: ["get", "watch", "list", "patch", "update", "create", "delete"]

<istio-system>命名空间​中的证书和验证权限

备注:

如果您尚未安装 Istio,命名空间在集群中可能不存在。您可以在安装 Istio 之前创建命名空间和角色,也可以在安装 Istio 之后创建角色。

在<istio-system>命名空间中执行以下操作:

  1. Automation Suite 先决条件检查工具会读取<istio-system>命名空间中的 Pod 和服务,以验证是否已正确安装和配置 Istio。
  2. 需要get secrets权限才能将证书文件从<istio-system>命名空间复制到<uipath>命名空间。

由于uipathadmin不会在 no-cluster-roles 流程中配置 Istio 或安装 WebAssembly (WASM) 插件,因此您可以使用此角色的只读变体。请集群管理员来执行这些操作(请参阅步骤 7 )。

以下示例显示了 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 project <uipath>
oc create rolebinding uipath-automationsuite-rolebinding \
  --role=uipath-automationsuite-role --serviceaccount=<uipath>:uipathadmin
oc project <istio-system>
oc create rolebinding istio-system-automationsuite-rolebinding \
  --role=istio-system-automationsuite-role --serviceaccount=<uipath>:uipathadmin
oc project <uipath>
oc create rolebinding uipath-automationsuite-rolebinding \
  --role=uipath-automationsuite-role --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

如果操作成功,您应该会看到一个名为uipathadminkubeconfig的kubeconfig文件。

步骤 5:为受限模式操作配置 input.json​

在 no-cluster-roles 流程中,您必须向 input.json 添加一些键,以便 uipathctl 和 UiPath 服务图表避免需要集群范围内的读取或资源的操作。以下部分介绍了每个键。

5.1 优先级类别​

将 ignore_priority_class 设置为 true:

{
  "ignore_priority_class": true
}
{
  "ignore_priority_class": true
}

此设置将执行以下操作:

  • 它会指示 uipathctl 跳过自身的 priorityclasses.scheduling.k8s.io 查找,否则这需要执行集群范围的读取。
  • 这会传播到所有 UiPath 服务图表,然后图表会省略其工作负载中的 priorityClassName。

因此,没有 Automation Suite Pod 引用PriorityClass ,因此集群上不需要也不需要预先创建PriorityClass 。

5.2 证书和入口​

添加证书和入口密钥。有关证书相关密钥的详细信息,请参阅证书要求。

{
  "server_certificate": {
    "tls_cert_file": "<path-to-tls.crt>",
    "tls_key_file":  "<path-to-tls.key>",
    "ca_cert_file":  "<path-to-ca.crt>"
  },

  "ingress": {
    "namespace": "<istio-system>",
    "gateway_selector": { "istio": "ingressgateway" },
    "ingress_gateway_secret": "istio-ingressgateway-certs"
  },

  "additional_ca_certs": "<path-to-ca.crt>"
}
{
  "server_certificate": {
    "tls_cert_file": "<path-to-tls.crt>",
    "tls_key_file":  "<path-to-tls.key>",
    "ca_cert_file":  "<path-to-ca.crt>"
  },

  "ingress": {
    "namespace": "<istio-system>",
    "gateway_selector": { "istio": "ingressgateway" },
    "ingress_gateway_secret": "istio-ingressgateway-certs"
  },

  "additional_ca_certs": "<path-to-ca.crt>"
}

仅当您的 TLS 证书由私有或自签名证书颁发机构签名时,才需要提供 additional_ca_certs 密钥。它会将 CA 捆绑包传播到所有 Automation Suite Pod 的信任存储。

5.3 AS Robot 并发限制​

重要提示:

仅当启用 AS 机器人 (asrobots) 时,才需要执行此步骤。

如果启用 AS 机器人,请设置显式的 concurrency_limit:

{
  "asrobots": {
    "enabled": true,
    "concurrency_limit": 2
  }
}
{
  "asrobots": {
    "enabled": true,
    "concurrency_limit": 2
  }
}

如果未设置 concurrency_limit,AS 机器人图表将部署 ClusterRole 和 ClusterRoleBinding,以自动读取节点容量和计算机器人并发。命名空间 ArgoCD 实例无法管理这些集群作用域的资源,因此 asrobots 应用程序无法同步:

ComparisonError: cluster level ClusterRoleBinding "<uipath>-asrobots-robot-resources-crb" can not be managed when in namespaced mode
ComparisonError: cluster level ClusterRoleBinding "<uipath>-asrobots-robot-resources-crb" can not be managed when in namespaced mode

使用显式 concurrency_limit,图表不会部署集群作用域的资源。

5.4 自备组件​

由于 uipathadmin 在此流程中没有集群范围的权限,因此安装程序无法部署创建集群范围资源的平台组件,例如 Istio、OPA Gatekeeper、cert-manager 和网络策略。您必须自行配置这些组件,并将其在 exclude_components 中列出,以便安装程序跳过它们。

在 exclude_components 中列出您自己提供的组件,并将 telemetry_optout 设置为 true,因为无法在此流程中启用遥测功能。有关组件列表和详细信息,请参阅“无需集群角色” 。

步骤 6:预先创建 TLS 证书密码​

由于 uipathadmin 仅在命名空间范围内,因此集群管理员必须在安装前在 istio-ingressgateway-certs 命名空间中创建 Secret <istio-system>。这不会授予 uipathadmin 任何额外权限;它会替代 uipathadmin 在具有集群范围权限时会完成的工作。(不需要创建PriorityClass - 该依赖项会由步骤 5.1中的ignore_priority_class删除。)

istio-ingressgateway-certs Secret 是在配置服务网格的过程中创建的。要创建它,请参阅配置 Istio 并安装 WASM 路由插件。

由于 uipathadmin 仅保存只读的 istio-system-automationsuite-role,因此它可以读取此 Secret,但无法创建;必须由集群管理员创建。

确保 Secret 包含所有三个密钥:tls.crt、tls.key 和 ca.crt,因为当您的 TLS 证书由私有或自签名证书颁发机构签名时,需要 ca.crt 密钥。

步骤 7:安装并配置服务网格和 GitOps 工具​

请遵循服务网格和 GitOps 工具的标准程序。这些过程为 uipathadmin 命名空间中的 <argocd> 创建额外的命名空间作用域角色和绑定;它们都不需要 uipathadmin 的集群范围权限。

  • 安装和配置服务网格- 安装 OpenShift Service网格。由于 uipathadmin 以只读 <istio-system> 角色运行,因此它本身无法配置 Istio 或安装 WASM 插件;集群管理员必须在安装 Automation Suite 之前设置 istio-configure。
  • 安装和配置 GitOps 工具- 配置专用 ArgoCD 实例并完成所有步骤。

有关istio-configure设置步骤,请参阅配置 Istio 并安装 WASM 路由插件。

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新