安装
第 1 章 安装构建 复制链接链接已复制到粘贴板!
作为集群管理员,您可以在 OpenShift Container Platform 集群上安装构建。
1.1. 先决条件 复制链接链接已复制到粘贴板!
- 访问 OpenShift Container Platform web 控制台。
-
已安装
oc
CLI。 - 以管理员身份登陆到 OpenShift Container Platform 集群。
- 您的集群启用了 Marketplace 功能,或者手动配置 Red Hat Operator 目录源。
作为依赖项组件,Red Hat OpenShift Pipelines Operator 会在安装过程中与 Red Hat OpenShift Operator 的构建一起自动安装。如果您已经安装了 Red Hat OpenShift Pipelines Operator,Builds 将该 Operator 用于其正常运行。
1.2. 使用 Web 控制台安装构建 复制链接链接已复制到粘贴板!
您可以使用 Red Hat OpenShift Web 控制台的构建从 OperatorHub 安装 Red Hat OpenShift Operator 构建。安装此 Operator 可让您安装和使用构建组件。
流程
- 在 Web 控制台的 Administrator 视角中,导航到 Operators → OperatorHub 页面。
- 使用 Filter by keyword 复选框在目录中搜索 Builds for Red Hat OpenShift Operator。
- 点 Builds for Red Hat OpenShift Operator 标题。
- 阅读有关 Operator 的简单描述并点 Install。
在 Install Operator 页中:
-
检查 Installation Mode 是否已设置为 All namespaces on the cluster (default)。此模式将 Operator 安装至默认
openshift-builds
命名空间,以便供集群中的所有命名空间监视和使用。 -
检查 Installed Namespace 是否默认设置为
openshift-builds
。 - 为 Approval Strategy 选择 Automatic。这样可确保以后对 Operator 的升级由 Operator Lifecycle Manager (OLM) 自动进行。如果您选择 Manual 批准策略,OLM 会创建一个更新请求。作为集群管理员,您必须手动批准 OLM 更新请求,才可将 Operator 更新至新版本。
选择一个 Update Channel:
- 更新频道 默认设置为 latest。latest 频道启用 Red Hat OpenShift Operator 构建的最新稳定版本。
-
要为 Red Hat OpenShift Operator 安装构建的特定版本,集群管理员可以使用对应的
builds-<version>
频道。例如,要为 Red Hat OpenShift Operator 版本1.1
安装构建,您可以使用builds-1.1
频道。
-
检查 Installation Mode 是否已设置为 All namespaces on the cluster (default)。此模式将 Operator 安装至默认
- 点 Install。
验证
安装构建 Red Hat OpenShift Operator 后,您必须验证是否已创建所需资源以确保控制器正常工作。
流程
- 在 Web 控制台的 Administrator 视角中,将项目选择为 openshift-builds。
- 导航到 Operators → Installed Operators 页面。
- 点 All instances 选项卡。
-
在 All instances 选项卡上,验证是否列出了
OpenShiftBuild
&ShipwrightBuild
实例。或者,您也可以单击 Open Shift Build 和 Shipwright Build 选项卡。 - 现在,进入到 Workloads → Pods 页面。
在 Pods 页面中,验证是否列出了以下 pod:
-
openshift-builds
operator pod - 构建控制器和构建 webhook pod
-
sharedresource
daemonset 和SharedResource
Webhook pod
-
1.3. 使用 CLI 安装构建 复制链接链接已复制到粘贴板!
您还可以使用命令行界面(CLI)安装构建。
流程
创建一个
sub.yaml
订阅对象文件,以便为 Red Hat OpenShift Operator 订阅 Builds 的命名空间,如下例所示:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 使用以下命令应用订阅对象:
oc apply -f sub.yml
$ oc apply -f sub.yml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Red Hat OpenShift Operator 的 Builds 现已安装在默认目标命名空间
openshift-builds
中。
验证
安装构建 Red Hat OpenShift Operator 后,您必须验证是否已创建以下资源以确保 Operator 正常工作:
运行以下命令,以确保创建了
OpenshiftBuild
资源:oc get openshiftbuilds
$ oc get openshiftbuilds
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 运行以下命令,以确保创建了
ShipwrightBuilds
资源:oc get shipwrightbuilds
$ oc get shipwrightbuilds
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 运行以下命令,以确保在
openshift-builds
命名空间中创建以下 pod:-
openshift-builds
operator pod - 构建控制器和构建 webhook pod
sharedresource daemonset 和 SharedResource Webhook pod
oc get pods -n openshift-builds
$ oc get pods -n openshift-builds
Copy to Clipboard Copied! Toggle word wrap Toggle overflow pod 列表显示,如下例所示:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
-
1.4. 禁用 ShipwrightBuilds 构建控制器和 webhook pod 复制链接链接已复制到粘贴板!
您可以在不禁用共享资源 Container Storage Interface (CSI)驱动程序组件和 ShipwrightBuilds
自定义资源定义(CRD)的情况下禁用 ShipwrightBuilds
自定义资源(CR)。禁用 ShipwrightBuilds
CR,会从 openshift-builds
命名空间中删除
构建控制器和 ShipwrightBuilds 构建 webhook pod。
ShipwrightBuilds
流程
运行以下命令禁用
ShipwrightBuilds
控制器和 webhook:oc patch openshiftbuild cluster --type=merge -p '{"spec":{"shipwright":{"build":{"state":"Disabled"}}}}'
$ oc patch openshiftbuild cluster --type=merge -p '{"spec":{"shipwright":{"build":{"state":"Disabled"}}}}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 此命令禁用构建控制器和 Webhook,但不会影响
ShipwrightBuilds
CRD。
Legal Notice
复制链接链接已复制到粘贴板!
Copyright © 2025 Red Hat
OpenShift documentation is licensed under the Apache License 2.0 (https://www.apache.org/licenses/LICENSE-2.0).
Modified versions must remove all Red Hat trademarks.
Portions adapted from https://github.com/kubernetes-incubator/service-catalog/ with modifications by Red Hat.
Red Hat, Red Hat Enterprise Linux, the Red Hat logo, the Shadowman logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat Software Collections is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation’s permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.