搜索

3.3. 在 Red Hat Ansible Automation Platform operator 上为自动化控制器配置外部数据库

download PDF

对于希望使用外部数据库部署 Ansible Automation Platform 的用户,可以通过使用实例凭证和连接信息配置 secret,然后使用 oc create 命令将其应用到其集群中。

默认情况下,Red Hat Ansible Automation Platform Operator 会在与 Ansible Automation Platform 部署相同的命名空间中创建并配置一个受管 PostgreSQL pod。您可以使用外部数据库部署 Ansible Automation Platform,而不是 Red Hat Ansible Automation Platform Operator 自动创建的受管 PostgreSQL pod。

使用外部数据库可让您共享和重复使用资源,并手动管理备份、升级和性能优化。

注意

只要数据库名称不同,同一个外部数据库(PostgreSQL 实例)可用于自动化 hub 和自动化控制器。换句话说,您可以在一个 PostgreSQL 实例中,带有使用不同名称的多个数据库。

以下部分概述了在 Ansible Automation Platform operator 上为自动化控制器配置外部数据库的步骤。

前提条件

外部数据库必须是 PostgreSQL 数据库,这是 Ansible Automation Platform 当前发行版本支持的版本。

注意

Ansible Automation Platform 2.4 支持 PostgreSQL 13。

流程

外部 postgres 实例凭证和连接信息必须存储在 secret 中,然后在自动化控制器 spec 中设置。

  1. 按照下面的模板,创建一个 postgres_configuration_secret .yaml 文件:

    apiVersion: v1
    kind: Secret
    metadata:
      name: external-postgres-configuration
      namespace: <target_namespace> 1
    stringData:
      host: "<external_ip_or_url_resolvable_by_the_cluster>" 2
      port: "<external_port>" 3
      database: "<desired_database_name>"
      username: "<username_to_connect_as>"
      password: "<password_to_connect_with>" 4
      sslmode: "prefer" 5
      type: "unmanaged"
    type: Opaque
    1
    要创建 secret 的命名空间。这应该是您要部署到的同一命名空间。
    2
    数据库节点的可解析的主机名。
    3
    外部端口默认为 5432
    4
    变量 password 的值不应包含单引号或双引号('、')或反斜杠(\),以避免在部署、备份或恢复过程中出现任何问题。
    5
    变量 sslmode 仅适用于外部数据库。允许的值是:prefer, disable, allow, require, verify-ca, 和 verify-full
  2. 使用 oc create 命令将 external-postgres-configuration-secret.yml 应用到您的集群。

    $ oc create -f external-postgres-configuration-secret.yml
  3. 在创建 AutomationController 自定义资源对象时,在 spec 中指定 secret,参见以下示例:

    apiVersion: automationcontroller.ansible.com/v1beta1
    kind: AutomationController
    metadata:
      name: controller-dev
    spec:
      postgres_configuration_secret: external-postgres-configuration
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.