8.2.3. 配置对断开连接的 OpenShift Container Platform 集群中的 Clair 数据库的访问


要为自助管理的部署配置对断开连接的 OpenShift Container Platform 集群中的 Clair 数据库的访问,您可以确定数据库服务、转发数据库端口并更新 Clair config.yaml 文件以使用 localhost。这可让您使用 clairctl 工具将更新程序捆绑包导入到数据库中。

先决条件

  • 您已安装了 clairctl 命令行工具工具。
  • 您已部署了 Clair。
  • disable_updatersairgap 参数在 Clair config.yaml 文件中被设置为 True
  • 您已从可访问互联网的 Clair 实例导出了更新程序捆绑包。

流程

  1. 使用 oc CLI 工具确定您的 Clair 数据库服务,例如:

    $ oc get svc -n quay-enterprise

    输出示例

    NAME                                  TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                             AGE
    example-registry-clair-app            ClusterIP      172.30.224.93    <none>        80/TCP,8089/TCP                     4d21h
    example-registry-clair-postgres       ClusterIP      172.30.246.88    <none>        5432/TCP                            4d21h
    ...

  2. 转发 Clair 数据库端口,使其可以从本地机器访问。例如:

    $ oc port-forward -n quay-enterprise service/example-registry-clair-postgres 5432:5432
  3. 更新 Clair config.yaml 文件,例如:

    indexer:
        connstring: host=localhost port=5432 dbname=postgres user=postgres password=postgres sslmode=disable
        layer_scan_concurrency: 5
        migrations: true
        scanlock_retry: 10
        airgap: true
        scanner:
          repo:
            rhel-repository-scanner:
              repo2cpe_mapping_file: /data/repository-to-cpe.json
          package:
            rhel_containerscanner:
              name2repos_mapping_file: /data/container-name-repos-map.json

    其中:

    connstring:: 指定数据库的连接字符串。

    rhel-repository-scanner:: 指定存储库扫描程序配置。

    rhel_containerscanner:: 指定容器扫描程序配置。

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

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

让开源更具包容性

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

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部