Argo CD 实例


Red Hat OpenShift GitOps 1.8

安装和部署 Argo CD 实例

Red Hat OpenShift Documentation Team

摘要

本文档提供有关安装和部署 Argo CD 实例以管理集群配置或部署应用程序的说明。

第 1 章 设置 Argo CD 实例

默认情况下,Red Hat OpenShift GitOps 在 openshift-gitops 命名空间中安装 Argo CD 实例,并使用额外的权限来管理某些集群范围的资源。要管理集群配置或部署应用程序,您可以安装和部署新的 Argo CD 实例。默认情况下,任何新实例都只能管理部署它的命名空间中的资源。

1.1. 安装 Argo CD 实例

要管理集群配置或部署应用程序,您可以安装和部署新的 Argo CD 实例。

流程

  1. 登陆到 OpenShift Container Platform Web 控制台。
  2. OperatorsInstalled Operators
  3. Project 下拉菜单中选择您要安装 Argo CD 实例的项目。
  4. 从安装的 operator 列表中选择 OpenShift GitOps Operator,然后点 Argo CD 选项卡。
  5. Create ArgoCD 配置参数:

    1. 输入实例的 Name。默认情况下,Name 设置为 示例
    2. 创建外部操作系统路由来访问 Argo CD 服务器。点 ServerRoute 并检查 Enabled
  6. 要打开 Argo CD web UI,请进入安装 Argo CD 实例的项目中的 Networking → Routes → <instance name>-server,点路由。

1.2. 为 Argo CD 服务器和存储库服务器启用副本

Argo CD-server 和 Argo CD-repo-server 工作负载是无状态的。要在 pod 中更好地分布工作负载,您可以增加 Argo CD-server 和 Argo CD-repo-server 副本的数量。但是,如果 Argo CD-server 上启用了 pod 横向自动扩展,它会覆盖您设置的副本数。

流程

  • reposerver spec 的 replicas 参数设置为您要运行的副本数:

    Argo CD 自定义资源示例

    apiVersion: argoproj.io/v1alpha1
    kind: ArgoCD
    metadata:
      name: example-argocd
      labels:
        example: repo
    spec:
      repo:
        replicas: <number_of_replicas>
      server:
        replicas: <number_of_replicas>
        route:
          enabled: true
          path: /
          tls:
            insecureEdgeTerminationPolicy: Redirect
            termination: passthrough
          wildcardPolicy: None
    Copy to Clipboard Toggle word wrap

1.3. 将资源部署到不同的命名空间中

要允许 Argo CD 管理除安装它外的其他命名空间中的资源,请使用 argocd.argoproj.io/managed-by 标签配置目标命名空间。

流程

  • 配置命名空间:

    $ oc label namespace <namespace> \
    argocd.argoproj.io/managed-by=<namespace> 
    1
    Copy to Clipboard Toggle word wrap
    1
    安装 Argo CD 的命名空间。

第 2 章 Argo CD 自定义资源和组件属性

ArgoCD 自定义资源(CRD)是一个 Kubernetes 自定义资源(CRD),用于描述给定 Argo CD 集群的所需状态,允许您配置组成 Argo CD 集群的组件。

2.1. Argo CD CLI 工具

Argo CD CLI 工具用于通过命令行配置 Argo CD。Red Hat OpenShift GitOps 不支持这个二进制文件。使用 OpenShift Console 配置 Argo CD。

2.2. Argo CD 自定义资源属性

Argo CD 自定义资源由以下属性组成:

Expand

Name

描述

Default(默认)

Properties

ApplicationInstanceLabelKey

Argo CD 注入应用程序名称的 metadata.label 键名称作为一个跟踪标签。

app.kubernetes.io/instance

 

ApplicationSet

ApplicationSet 控制器配置选项。

<Object>

  • <Image> - ApplicationSet 控制器的容器镜像。这会覆盖 ARGOCD_APPLICATIONSET_IMAGE 环境变量。
  • <Version> - ApplicationSet 容器镜像使用的标签。
  • <Resources> - 容器计算资源。
  • <LogLevel> - Argo CD Application Controller 组件使用的日志级别。有效选项包括 debuginfoerrorwarn
  • <LogFormat> - Argo CD Application Controller 组件使用的日志格式。有效选项为 textjson
  • <PrallelismLimit> - 为控制器设置的 kubectl parallelism 限制 (--kubectl-parallelism-limit 标志)

ConfigManagementPlugins

添加配置管理插件。

<empty>

 

Controller

Argo CD Application Controller 选项。

<Object>

  • <Processors.Operation> - 操作处理器数量。
  • <Processors.Status> - 状态处理器数量。
  • <Resources> - 容器计算资源。
  • <LogLevel> - Argo CD Application Controller 组件使用的日志级别。有效选项包括 debuginfoerrorwarn
  • <AppSync> - AppSync 用于控制 Argo CD 应用程序的同步频率
  • <Sharding.enabled> - 在 Argo CD Application Controller 组件中启用分片。此属性用于管理大量集群,以减轻控制器组件的内存压力。
  • <Sharding.replicas> - 用于支持 Argo CD Application Controller 的分片的副本数量。
  • <Env> - 为应用程序控制器工作负载设置的环境。

DisableAdmin

禁用内置的 admin 用户。

false

 

GATrackingID

使用 Google Analytics 跟踪 ID。

<empty>

 

GAAnonymizeusers

启用发送至 google 分析的散列用户名。

false

 

HA

高可用性选项。

<Object>

  • <Enabled> - 为 Argo CD 切换全局的高可用性支持。
  • <RedisProxyImage> - Redis HAProxy 容器镜像。这会覆盖 ARGOCD_REDIS_HA_PROXY_IMAGE 环境变量。
  • <RedisProxyVersion> - 用于 Redis HAProxy 容器镜像的标签。

HelpChatURL

用于获取聊天帮助的 URL(通常是您的 Slack 频道支持)。

https://mycorp.slack.com/argo-cd

 

HelpChatText

显示在进行聊天帮助的文本框中。

现在聊天!

 

镜像

所有 Argo CD 组件的容器镜像。这会覆盖 ARGOCD_IMAGE 环境变量。

argoproj/argocd

 

入口

Ingress 配置选项。

<Object>

 

InitialRepositories

初始 Git 存储库,将 Argo CD 配置为在创建集群时使用。

<empty>

 

通知

通知控制器配置选项。

<Object>

  • <Enabled> - 切换启动 notifications-controller。
  • <Image> - 所有 Argo CD 组件的容器镜像。这会覆盖 ARGOCD_IMAGE 环境变量。
  • <Version> - 与 Notifications 容器镜像一起使用的标签。
  • <Resources> - 容器计算资源。
  • <LogLevel> - Argo CD Application Controller 组件使用的日志级别。有效选项包括 debuginfoerrorwarn

RepositoryCredentials

Git 存储库凭证模板,将 Argo CD 配置为在创建集群时使用。

<empty>

 

InitialSSHKnownHosts

创建集群时要使用的初始 SSH 已知问题供 Argo CD 使用。

<default_Argo_CD_Known_Hosts>

 

KustomizeBuildOptions

用于 kustomize build 的构建选项和参数。

<empty>

 

OIDCConfig

OIDC 配置作为 Dex 的替代方案。

<empty>

 

NodePlacement

添加 nodeSelectortolerations

<empty>

 

Prometheus

Prometheus 配置选项。

<Object>

  • <Enabled> - 为 Argo CD 切换全局的 Prometheus 支持。
  • <Host> - 用于 Ingress 或 Route 资源的主机名。
  • <Ingress> - 为 Prometheus 切换 Ingress。
  • <Route> - 路由配置选项。
  • <Size> - Prometheus StatefulSet 的副本数。

RBAC

RBAC 配置选项。

<Object>

  • <DefaultPolicy> - 在 argocd-rbac-cm 配置映射的 policy.default 属性。在授权 API 请求时,Argo CD 将回退到的默认角色的名称。
  • <Policy> - argocd-rbac-cm 配置映射中的 policy.csv 属性。包含用户定义的 RBAC 策略和角色定义的 CSV 数据。
  • <Scopes> - argocd-rbac-cm 配置映射中的 scopes 属性。控制在 RBAC 执行过程中要检查的 OIDC 范围(子范围除外)。

Redis

Redis 配置选项。

<Object>

  • <AutoTLS> - 使用供应商创建 Redis 服务器的 TLS 证书 (one of: openshift)。目前仅适用于 OpenShift Container Platform。
  • <DisableTLSVerification> - 定义 Redis 服务器是否应该使用严格的 TLS 验证进行访问。
  • <Image> - Redis 的容器镜像。这会覆盖 ARGOCD_REDIS_IMAGE 环境变量。
  • <Resources> - 容器计算资源。
  • <Version> - 与 Redis 容器镜像一起使用的标签。

ResourceCustomizations

自定义资源行为。

<empty>

 

ResourceExclusions

完全忽略整个资源组类别。

<empty>

 

ResourceInclusions

配置要应用哪些资源组/kinds 的配置。

<empty>

 

Server

Argo CD Server 配置选项。

<Object>

  • <Autoscale> - 服务器自动扩展配置选项。
  • <ExtraCommandArgs> - Operator 设置的现有参数列表。
  • <GRPC> - GRPC 配置选项。
  • <Host> - 用于 Ingress 或 Route 资源的主机名。
  • <Ingress> - Argo CD 服务器组件的 Ingress 配置。
  • <insecure> - 切换 Argo CD 服务器的 insecure 标志。
  • <Resources> - 容器计算资源。
  • <Replicas> - Argo CD 服务器的副本数量。必须大于或等于 0。如果启用了 Autoscale,则忽略 Replicas
  • <Route> - 路由配置选项。
  • <Service.Type> - 用于服务资源的 ServiceType
  • <Loglevel> - Argo CD Server 组件使用的日志级别。有效选项包括 debuginfoerrorwarn
  • <LogFormat> - Argo CD Application Controller 组件使用的日志格式。有效选项为 textjson
  • <Env> - 为服务器工作负载设置的环境。

SSO

单点登录选项。

<Object>

  • <Image> - Keycloak 的容器镜像。这会覆盖 ARGOCD_KEYCLOAK_IMAGE 环境变量。
  • <Keycloak> - Keycloak SSO 供应商的配置选项。
  • <Dex> - Dex SSO 供应商的配置选项。
  • <Provider> - 配置单点登录的供应商名称。现在,支持的选项有 Dex 和 Keycloak。
  • <Resources> - 容器计算资源。
  • <VerifyTLS> - 与 Keycloak 服务通信时用于强制进行严格的 TLS 检查。
  • <Version> - 与 Keycloak 容器镜像一起使用的标签。

StatusBadgeEnabled

启用应用程序状态徽标。

true

 

TLS

TLS 配置选项。

<Object>

  • <CA.ConfigMapName> - 包含 CA 证书的 ConfigMap 名称。
  • <CA.SecretName> - 包含 CA 证书和密钥的 secret 名称。
  • <InitialCerts> - argocd-tls-certs-cm 配置映射中的初始证书集合,以通过 HTTPS 连接 Git 存储库。

UserAnonyousEnabled

启用匿名用户访问。

true

 

版本

用于所有 Argo CD 组件的容器镜像的标签。

最新的 Argo CD 版本

 

横幅

添加 UI 横幅消息。

<Object>

  • <Banner.Content> - 横幅消息内容(如果显示了横幅,则必需)。
  • <Banner.URL.SecretName> - 横幅消息链接 URL (可选)。

2.3. 仓库服务器属性

以下属性可用于配置 Repo 服务器组件:

Expand

Name

默认

描述

Resources

<empty>

容器计算资源。

MountSAToken

false

ServiceAccount 令牌是否应挂载到 repo-server pod。

ServiceAccount

""

与 repo-server pod 搭配使用的 ServiceAccount 的名称。

VerifyTLS

false

在与仓库服务器通信时,是否在所有组件上执行严格的 TLS 检查。

AutoTLS

""

用于设置 TLS provider,用于设置 repo-server 的 gRPC TLS 证书(:openshift 之一)。目前仅适用于 OpenShift。

镜像

argoproj/argocd

Argo CD Repo 服务器的容器镜像。这会覆盖 ARGOCD_REPOSERVER_IMAGE 环境变量。

版本

.spec.Version 相同

与 Argo CD Repo 服务器一起使用的标签。

LogLevel

info

Argo CD Repo 服务器使用的日志级别。有效选项包括 debug、info、error 和 warn。

LogFormat

text

Argo CD Repo 服务器使用的日志格式。有效选项为 text 或 json。

ExecTimeout

180

呈现工具(如 Helm、Kustomize)的执行超时(如 Helm、Kustomize)。

Env

<empty>

为仓库服务器工作负载设置的环境。

Replicas

<empty>

Argo CD Repo 服务器的副本数。必须大于或等于 0

2.4. 使用 Argo CD 实例启用通知

要启用或禁用 Argo CD 通知控制器,在 Argo CD 自定义资源中设置参数。默认情况下禁用通知。要启用通知,在 .yaml 文件中将 enabled 参数设置为 true

流程

  1. enabled 参数设置为 true
apiVersion: argoproj.io/v1alpha1
kind: ArgoCD
metadata:
  name: example-argocd
spec:
  notifications:
    enabled: true
Copy to Clipboard Toggle word wrap

法律通告

Copyright © 2024 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat 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 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.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat