×

Red Hat OpenShift GitOps argocd CLI 工具仅为技术预览功能。技术预览功能不受 Red Hat 生产服务级别协议 (SLA) 支持,可能功能不完整。Red Hat 不建议在生产环境中使用它们。这些功能可让客户提前访问即将推出的产品功能,从而能够在开发过程中测试功能并提供反馈。

有关 Red Hat 技术预览功能的支持范围的更多信息,请参阅 技术预览功能支持范围

使用 GitOps argocd CLI 工具可从命令行配置和管理 Red Hat OpenShift GitOps 和 Argo CD 资源。GitOps argocd CLI 旨在使 GitOps 计算任务简单明了。您可以在不同的平台上安装 CLI 工具。

压缩存档和 RPM 都包含 argocd 可执行二进制文件。如果您在 Red Hat 帐户中拥有活动的 OpenShift Container Platform 订阅,请使用包管理器(例如 yumdnf)将 CLI 工具作为 RPM 安装。

在 Linux 上安装 Red Hat OpenShift GitOps CLI

对于 Linux 发行版,您可以将 GitOps argocd CLI 下载为 tar.gz 存档。

步骤
  1. 内容网关下载适用于您操作系统和架构的最新版 CLI 工具。

    操作系统 架构 压缩包

    Linux

    x86_64, amd64

    argocd-linux-amd64.tar.gz

    IBM zSystems 和 IBM® LinuxONE 上的 Linux

    s390x

    argocd-linux-s390x.tar.gz

    IBM Power 上的 Linux

    ppc64le

    argocd-linux-ppc64le.tar.gz

    ARM 上的 Linux

    aarch64, arm64

    argocd-linux-arm64.tar.gz

    较新版本的 CLI 工具兼容较旧版本的 Red Hat OpenShift GitOps 服务器,但反之则不然。

  2. 运行以下命令解压归档文件

    $ tar xvzf <file>
  3. 运行以下命令将二进制文件移动到您的PATH环境变量中的目录

    $ sudo mv argocd /usr/local/bin/argocd
  4. 运行以下命令使文件可执行

    $ sudo chmod +x /usr/local/bin/argocd
  5. 安装 GitOps argocd CLI 后,运行以下命令验证其可用性

    $ argocd version --client
    示例输出
    argocd: v2.9.5+f943664
      BuildDate: 2024-02-15T05:19:27Z
      GitCommit: f9436641a616d277ab1f98694e5ce4c986d4ea05
      GitTreeState: clean
      GoVersion: go1.20.10
      Compiler: gc
      Platform: linux/amd64
      ExtraBuildInfo: openshift-gitops-version: 1.12.0, release: 0015022024 (1)
    
    1 Red Hat 构建的 Red Hat OpenShift GitOps 的构建信息。

使用 RPM 在 Linux 上安装 Red Hat OpenShift GitOps CLI

对于 Red Hat Enterprise Linux (RHEL) 8 或更高版本,您可以使用包管理器(例如yumdnf)将 GitOps argocd CLI 作为 RPM 安装。这允许系统自动管理 GitOps argocd CLI 版本。例如,使用诸如dnf upgrade之类的命令可以升级所有软件包,包括argocd(如果可用新版本)。

先决条件
  • 您在 Red Hat 帐户中拥有有效的 OpenShift Container Platform 订阅。

  • 您在本地系统上具有 root 或sudo权限。

步骤
  1. 运行以下命令注册 Red Hat Subscription Manager

    # subscription-manager register
  2. 运行以下命令拉取最新的订阅数据

    # subscription-manager refresh
  3. 运行以下命令列出可用的订阅

    # subscription-manager list --available --matches '*gitops*'
  4. 在先前命令的输出中,找到您的 OpenShift Container Platform 订阅的池 ID,然后运行以下命令将订阅附加到已注册的系统

    # subscription-manager attach --pool=<pool_id>
  5. 运行以下命令启用 Red Hat OpenShift GitOps 在 RHEL 8 或更高版本所需的存储库

    • Linux (x86_64, amd64)

      # subscription-manager repos --enable="gitops-<gitops_version>-for-rhel-<rhel_version>-x86_64-rpms"
      示例命令
      # subscription-manager repos --enable="gitops-1.15-for-rhel-8-x86_64-rpms"
    • IBM zSystems 和 IBM® LinuxONE 上的 Linux (s390x)

      # subscription-manager repos --enable="gitops-<gitops_version>-for-rhel-<rhel_version>-s390x-rpms"
      示例命令
      # subscription-manager repos --enable="gitops-1.15-for-rhel-8-s390x-rpms"
    • IBM Power 上的 Linux (ppc64le)

      # subscription-manager repos --enable="gitops-<gitops_version>-for-rhel-<rhel_version>-ppc64le-rpms"
      示例命令
      # subscription-manager repos --enable="gitops-1.15-for-rhel-8-ppc64le-rpms"
    • ARM 上的 Linux (aarch64, arm64)

      # subscription-manager repos --enable="gitops-<gitops_version>-for-rhel-<rhel_version>-aarch64-rpms"
      示例命令
      # subscription-manager repos --enable="gitops-1.15-for-rhel-8-aarch64-rpms"
  6. 运行以下命令安装openshift-gitops-argocd-cli

    # yum install openshift-gitops-argocd-cli
  7. 安装 GitOps argocd CLI 后,运行以下命令验证其可用性

    $ argocd version --client
    示例输出
    argocd: v2.9.5+f943664
      BuildDate: 2024-02-15T05:19:27Z
      GitCommit: f9436641a616d277ab1f98694e5ce4c986d4ea05
      GitTreeState: clean
      GoVersion: go1.20.10
      Compiler: gc
      Platform: linux/amd64
      ExtraBuildInfo: openshift-gitops-version: 1.12.0, release: 0015022024 (1)
    
    1 Red Hat 构建的 Red Hat OpenShift GitOps 的构建信息。

在 Windows 上安装 Red Hat OpenShift GitOps CLI

对于 Windows,您可以将 GitOps argocd CLI 下载为压缩的zip存档。

步骤
  1. 内容网关下载适用于您操作系统和架构的最新版 CLI 工具。

    操作系统 架构 压缩包

    Windows

    x86_64

    argocd-windows-amd64.zip

    较新版本的 CLI 工具兼容较旧版本的 Red Hat OpenShift GitOps 服务器,但反之则不然。

  2. 使用 ZIP 程序解压归档文件。

  3. 运行以下命令将二进制文件移动到您的PATH环境变量中的目录

    C:\> move argocd.exe <directory>
  4. 安装 GitOps argocd CLI 后,运行以下命令验证其可用性

    $ argocd version --client
    示例输出
    argocd: v2.9.5+f943664
      BuildDate: 2024-02-15T05:19:27Z
      GitCommit: f9436641a616d277ab1f98694e5ce4c986d4ea05
      GitTreeState: clean
      GoVersion: go1.20.10
      Compiler: gc
      Platform: linux/amd64
      ExtraBuildInfo: openshift-gitops-version: 1.12.0, release: 0015022024 (1)
    
    1 Red Hat 构建的 Red Hat OpenShift GitOps 的构建信息。

在 macOS 上安装 Red Hat OpenShift GitOps CLI

对于 macOS,您可以将 GitOps argocd CLI 下载为tar.gz存档。

步骤
  1. 内容网关下载适用于您操作系统和架构的最新版 CLI 工具。

    操作系统 架构 压缩包

    英特尔版 macOS

    x86_64

    argocd-macos-amd64.tar.gz

    ARM 版 macOS

    arm64

    argocd-macos-arm64.tar.gz

    较新版本的 CLI 工具兼容较旧版本的 Red Hat OpenShift GitOps 服务器,但反之则不然。

  2. 运行以下命令解压归档文件

    $ tar xvzf <file>
  3. 运行以下命令将二进制文件移动到您的PATH环境变量中的目录

    $ sudo mv argocd /usr/local/bin/argocd
  4. 运行以下命令使文件可执行

    $ sudo chmod +x /usr/local/bin/argocd
  5. 安装 GitOps argocd CLI 后,运行以下命令验证其可用性

    $ argocd version --client
    示例输出
    argocd: v2.9.5+f943664
      BuildDate: 2024-02-15T05:19:27Z
      GitCommit: f9436641a616d277ab1f98694e5ce4c986d4ea05
      GitTreeState: clean
      GoVersion: go1.20.10
      Compiler: gc
      Platform: linux/amd64
      ExtraBuildInfo: openshift-gitops-version: 1.12.0, release: 0015022024 (1)
    
    1 Red Hat 构建的 Red Hat OpenShift GitOps 的构建信息。