第 2 章 准备 OpenShift 集群


本章介绍了如何在 OpenShift 上安装 Red Hat Integration - Camel K 和 OpenShift Serverless,以及如何在开发环境中安装所需的 Camel K 和 OpenShift Serverless 命令行工具。

2.1. 安装 Camel K

您可以从 OperatorHub 在 OpenShift 集群上安装 Red Hat Integration - Camel K Operator。OperatorHub 由 OpenShift Container Platform Web 控制台获得,为集群管理员提供了一个界面,以发现和安装 Operator。

安装 Camel K Operator 后,您可以安装 Camel K CLI 工具以命令行访问所有 Camel K 功能。

先决条件

  • 您可以访问具有正确访问级别的 OpenShift 4.6 (或更新版本)集群、创建项目和安装操作器的功能,以及在本地系统上安装 CLI 工具。

    注意
    You do not need to create a pull secret when installing Camel K from the OpenShift OperatorHub. The Camel K Operator automatically reuses the OpenShift cluster-level authentication to pull the Camel K image from `registry.redhat.io`.
    Copy to Clipboard Toggle word wrap
  • 已安装 OpenShift CLI 工具(oc),以便可以在命令行中与 OpenShift 集群交互。有关如何安装 OpenShift CLI 的详情,请参阅安装 OpenShift CLI

流程

  1. 在 OpenShift Container Platform Web 控制台中,使用具有集群管理员特权的帐户登录。
  2. 创建新的 OpenShift 项目:

    1. 在左侧导航菜单中点 Home > Project > Create Project
    2. 输入项目名称,如 my-camel-k-project,然后单击 Create
  3. 在左侧导航菜单中点 Operators > OperatorHub
  4. Filter by keyword 文本框中,键入 Camel K,然后点 Red Hat Integration - Camel K Operator 卡。
  5. 阅读有关操作器的信息,然后单击 Install。Operator 安装页面将打开。
  6. 选择以下订阅设置:

    • Update Channel > latest
    • 选择以下 2 个选项:

      • Installation Mode > A specific namespace on the cluster > my-camel-k-project
      • Installation Mode > All namespaces on the cluster (default) > Openshift operator
    注意
    If you do not choose among the above two options, the system by default chooses a global namespace on the cluster then leading to openshift operator.
    Copy to Clipboard Toggle word wrap
    • Approval Strategy > Automatic

      注意

      如果您的环境需要,可以使用 Installation mode > All namespaces on the clusterApproval Strategy > Manual settings。

  7. Install,等待片刻,直到 Camel K Operator 准备就绪。
  8. 下载并安装 Camel K CLI 工具:

    1. 在 OpenShift Web 控制台顶部的 帮助菜单(?) 中,选择 Command line tools
    2. 向下滚动到 kamel - Red Hat Integration - Camel K - Command Line Interface 部分。
    3. 单击链接以下载本地操作系统的二进制文件(Linux、Mac、Windows)。
    4. 在您的系统路径中解压并安装 CLI。
    5. 要验证您可以访问 Kamel K CLI,请打开一个命令窗口,然后输入以下内容:

      kamel --help

      此命令显示有关 Camel K CLI 命令的信息。

后续步骤

(可选) 指定 Camel K 资源限值

2.1.1. 指定 Camel K 资源限值

安装 Camel K 时,Camel K 的 OpenShift pod 没有为 CPU 和内存(RAM)资源设置任何限制。如果要为 Camel K 定义资源限值,您必须编辑在安装过程中创建的 Camel K 订阅资源。

前提条件

  • 您有集群管理员访问安装 Camel K Operator 的 OpenShift 项目,如 安装 Camel K 所述。
  • 您知道要应用到 Camel K 订阅的资源限值。有关资源限值的更多信息,请参阅以下文档:

流程

  1. 登录 OpenShift Web 控制台。
  2. 选择 Operators > Installed Operators > Operator Details > Subscription
  3. 选择 Actions > Edit Subscription

    订阅的文件在 YAML 编辑器中打开。

  4. spec 部分下,添加一个 config.resources 部分,并为 memory 和 cpu 提供值,如下例所示:

    spec:
      channel: default
      config:
        resources:
          limits:
            memory: 512Mi
            cpu: 500m
          requests:
            cpu: 200m
            memory: 128Mi
    Copy to Clipboard Toggle word wrap
  5. 保存您的更改。

OpenShift 更新订阅并应用您指定的资源限值。

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat