17.2. 配置防火墙

如果使用防火墙,您必须进行配置,以便 OpenShift Container Platform 能访问正常运作所需要的网站。您必须始终授予一些站点的访问权限,如果使用 Red Hat Insights、Telemetry 服务、托管集群的云以及某些构建策略,则还要授予更多站点的访问权限。

17.2.1. 为 OpenShift Container Platform 配置防火墙

在安装 OpenShift Container Platform 之前,您必须配置防火墙,以授予 OpenShift Container Platform 所需站点的访问权限。

和在 worker 节点上运行的服务相比,运行在控制器节点中的服务没有特殊的配置注意事项。

流程

  1. 允许以下 registry URL:

    URL端口功能

    registry.redhat.io

    443, 80

    提供核心容器镜像

    quay.io

    443, 80

    提供核心容器镜像

    cdn.quay.io

    443, 80

    提供核心容器镜像

    cdn01.quay.io

    443, 80

    提供核心容器镜像

    cdn02.quay.io

    443, 80

    提供核心容器镜像

    cdn03.quay.io

    443, 80

    提供核心容器镜像

    sso.redhat.com

    443, 80

    https://console.redhat.com/openshift 站点使用来自 sso.redhat.com 的身份验证

    您可以在 allowlist 中使用通配符 *.quay.io 而不是 cdn0[1-3].quay.io。在 allowlist 中添加站点(如 quay.io )时,不要向 denylist 添加通配符条目,如 *.quay.io。在大多数情况下,镜像 registry 使用内容交付网络(CDN)来提供镜像。如果防火墙阻止访问,则当初始下载请求重定向到一个主机名(如 cdn01.quay.io )时,镜像下载将被拒绝。

  2. 将提供构建所需语言或框架的资源的任何站点列入允许列表。
  3. 如果不禁用 Telemetry,您必须授予对以下 URL 的访问权限,以便能访问 Red Hat Insights:

    URL端口功能

    cert-api.access.redhat.com

    443, 80

    Telemetry 所需

    api.access.redhat.com

    443, 80

    Telemetry 所需

    infogw.api.openshift.com

    443, 80

    Telemetry 所需

    console.redhat.com/api/ingress

    443, 80

    Telemetry 和 insights-operator 需要

  4. 如果使用 Amazon Web Services (AWS)、Microsoft Azure 或 Google Cloud Platform (GCP) 来托管您的集群,您必须授予对提供该云的云供应商 API 和 DNS 的 URL 的访问权限:

    URL端口功能

    AWS

    *.amazonaws.com

    443, 80

    需要此项以访问 AWS 服务和资源。请参阅 AWS 文档中 AWS Service Endpoints,以确定您使用的区域所允许的具体端点。

    GCP

    *.googleapis.com

    443, 80

    需要此项以访问 GCP 服务和资源。请参阅 GCP 文档中的 Cloud Endpoints,以确定您的 API 所允许的端点。

    accounts.google.com

    443, 80

    需要此项以访问您的 GCP 帐户。

    Azure

    management.azure.com

    443, 80

    需要此项以访问 Azure 服务和资源。请参阅 Azure 文档中的 Azure REST API 参考,以确定您的 API 所允许的端点。

    *.blob.core.windows.net

    443, 80

    需要此项以下载 Ignition 文件。

    login.microsoftonline.com

    443, 80

    需要此项以访问 Azure 服务和资源。请参阅 Azure 文档中的 Azure REST API 参考,以确定您的 API 所允许的端点。

  5. 将以下 URL 列入允许列表:

    URL端口功能

    mirror.openshift.com

    443, 80

    需要此项以访问镜像安装内容和镜像。此站点也是发行镜像签名的来源,但 Cluster Version Operator 只需要一个可正常工作的源。

    storage.googleapis.com/openshift-release

    443, 80

    发行版本镜像签名源,但 Cluster Version Operator 只需要一个可正常工作的源。

    *.apps.<cluster_name>.<base_domain>

    443, 80

    需要此项以访问默认的集群路由,除非您在安装过程中设置了入口通配符。

    quayio-production-s3.s3.amazonaws.com

    443, 80

    需要此项以访问 AWS 中的 Quay 镜像内容。

    api.openshift.com

    443, 80

    集群令牌需要,并检查集群是否有可用的更新。

    rhcos-redirector.apps.art.xq1c.p1.openshiftapps.com,
    rhcos.mirror.openshift.com

    443, 80

    需要此项以下载 Red Hat Enterprise Linux CoreOS(RHCOS)镜像。

    console.redhat.com/openshift

    443, 80

    集群令牌所需

    registry.access.redhat.com

    443, 80

    odo CLI 需要。

    sso.redhat.com

    443, 80

    https://console.redhat.com/openshift 站点使用来自 sso.redhat.com 的身份验证

    操作员需要路由访问权限来执行健康检查。特别是,身份验证和 Web 控制台 Operator 会连接到两个路由,以验证路由是否正常工作。如果您是集群管理员,且不想允许 *.apps.<cluster_name>.<base_domain>,请允许这些路由:

    • oauth-openshift.apps.<cluster_name>.<base_domain>
    • console-openshift-console.apps.<cluster_name>.<base_domain>,或者,在 consoles.operator/cluster 对象的 spec.route.hostname 字段中指定的主机名(如果此字段非空)。
  6. 将以下 URL 列入允许的可选第三方内容:

    URL端口功能

    registry.connect.redhat.com

    443, 80

    所有第三方镜像和认证操作器必填.

    rhc4tp-prod-z8cxf-image-registry-us-east-1-evenkyleffocxqvofrk.s3.dualstack.us-east-1.amazonaws.com

    443, 80

    提供对托管在 registry.connect.redhat.com上的容器镜像的访问

    oso-rhc4tp-docker-registry.s3-us-west-2.amazonaws.com

    443, 80

    对于 Sonatype Nexus、F5 大 IP 操作器是必需的。

  7. 如果您使用默认的 Red Hat Network Time Protocol(NTP)服务器允许以下 URL:

    • 1.rhel.pool.ntp.org
    • 2.rhel.pool.ntp.org
    • 3.rhel.pool.ntp.org
注意

如果您没有使用默认的 Red Hat NTP 服务器,请验证您的平台的 NTP 服务器并在您的防火墙中允许它。