Argo CD 实例


Red Hat OpenShift GitOps 1.9

安装和部署 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 实例的项目。
    1. 输入实例的 Name
    2. 创建外部操作系统路由来访问 Argo CD 服务器。点 ServerRoute 并检查 Enabled

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

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

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

流程

  • 配置命名空间:

    $ oc label namespace <namespace> \
    argocd.argoproj.io/managed-by=<namespace> 1
    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 自定义资源由以下属性组成:

Name

描述

Default(默认)

Properties

applicationInstanceLabelKey

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

app.kubernetes.io/instance

 

applicationSet

<object>

  • 这会覆盖 ARGOCD_APPLICATIONSET_IMAGE 环境变量。
  • 有效选项包括 debuginfoerrorwarn
  • 有效选项为 textjson

configManagementPlugins

添加配置管理插件。

<empty>

 

controller

Argo CD Application Controller 选项。

<object>

  • 有效选项包括 debuginfoerrorwarn
  • 此属性用于管理大量集群,以减轻控制器组件的内存压力。

disableAdmin

禁用内置的 admin 用户。

false

 

gaTrackingID

使用 Google Analytics 跟踪 ID。

<empty>

 

gaAnonymizeUsers

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

false

 

ha

高可用性选项。

<object>

  • 这会覆盖 ARGOCD_REDIS_HA_PROXY_IMAGE 环境变量。

helpChatURL

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

 

helpChatText

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

现在聊天!

 

image

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

argoproj/argocd

 

ingress

Ingress 配置选项。

<object>

 

initialRepositories

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

<empty>

 

notifications

通知控制器配置选项。

<object>

  • 这会覆盖 ARGOCD_IMAGE 环境变量。
  • 有效选项包括 debuginfoerrorwarn

repositoryCredentials

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

<empty>

 

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

<default_Argo_CD_Known_Hosts>

 

kustomizeBuildOptions

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

<empty>

 

oidcConfig

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

<empty>

 

nodePlacement

添加 nodeSelectortolerations

<empty>

 

prometheus

Prometheus 配置选项。

<object>

rbac

RBAC 配置选项。

<object>

  • 包含用户定义的 RBAC 策略和角色定义的 CSV 数据。

redis

Redis 配置选项。

<object>

  • 这会覆盖 ARGOCD_REDIS_IMAGE 环境变量。

resourceCustomizations

自定义资源行为。

<empty>

 

resourceExclusions

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

<empty>

 

resourceInclusions

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

<empty>

 

server

Argo CD Server 配置选项。

<object>

  • 必须大于或等于 0
  • 有效选项包括 debuginfoerrorwarn
  • 有效选项为 textjson

sso

单点登录选项。

<object>

  • 这会覆盖 ARGOCD_KEYCLOAK_IMAGE 环境变量。
  • 现在,支持的选项有 Dex 和 Keycloak。

statusBadgeEnabled

启用应用程序状态徽标。

true

 

tls

TLS 配置选项。

<object>

userAnonyousEnabled

启用匿名用户访问。

true

 

version

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

最新的 Argo CD 版本

 

添加 UI 横幅消息。

<object>

2.3. 仓库服务器属性

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

Name

默认

描述

resources

<empty>

容器计算资源。

false

""

verifytls

false

""

image

argoproj/argocd

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

version

.spec.Version 相同

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

logLevel

info

Argo CD Repo 服务器使用的日志级别。有效选项包括 debuginfoerrorwarn

logFormat

text

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

180

env

<empty>

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

replicas

<empty>

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

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

先决条件

流程

  1. 导航到 OperatorsInstalled Operators 页面。
  2. Example

    apiVersion: argoproj.io/v1alpha1
    kind: ArgoCD
    metadata:
      name: openshift-gitops
    spec:
      notifications:
        enabled: true
    #....

  3. 点击 Save
提示

例如:

oc patch argocd openshift-gitops -n openshift-gitops --type merge --patch '{"spec": {"notifications": {"enabled": true}}}'

2.4.1. 其他资源

法律通告

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 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

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

© 2024 Red Hat, Inc.