20.2. 配置防火墙

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

20.2.1. 为 OpenShift Container Platform 配置防火墙

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

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

注意

如果您的环境在 OpenShift Container Platform 集群前面有一个专用的负载均衡器,请查看防火墙和负载均衡器之间的允许列表,以防止对集群造成不必要的网络限制。

流程

  1. 允许以下 registry URL:

    URLport功能

    registry.redhat.io

    443, 80

    提供核心容器镜像

    access.redhat.com

    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的身份验证

    您可以在允许列表中使用通配符 *.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:

    URLport功能

    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,cloud.redhat.com/api/ingress

    443, 80

    Telemetry 和 insights-operator需要

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

    URLport功能

    AWS

    *.amazonaws.com

    或者,如果您选择不对 AWS API 使用通配符,则必须列出以下 URL:

    443, 80

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

    ec2.amazonaws.com

    443

    用于在 AWS 环境中安装和管理集群。

    events.amazonaws.com

    443

    用于在 AWS 环境中安装和管理集群。

    iam.amazonaws.com

    443

    用于在 AWS 环境中安装和管理集群。

    route53.amazonaws.com

    443

    用于在 AWS 环境中安装和管理集群。

    s3.amazonaws.com

    443

    用于在 AWS 环境中安装和管理集群。

    s3.<aws_region>.amazonaws.com

    443

    用于在 AWS 环境中安装和管理集群。

    s3.dualstack.<aws_region>.amazonaws.com

    443

    用于在 AWS 环境中安装和管理集群。

    sts.amazonaws.com

    443

    用于在 AWS 环境中安装和管理集群。

    sts.<aws_region>.amazonaws.com

    443

    用于在 AWS 环境中安装和管理集群。

    tagging.us-east-1.amazonaws.com

    443

    用于在 AWS 环境中安装和管理集群。此端点始终为 us-east-1,无论集群要部署到的区域。

    ec2.<aws_region>.amazonaws.com

    443

    用于在 AWS 环境中安装和管理集群。

    elasticloadbalancing.<aws_region>.amazonaws.com

    443

    用于在 AWS 环境中安装和管理集群。

    servicequotas.<aws_region>.amazonaws.com

    443, 80

    必需。用于确认用于部署该服务的配额。

    tagging.<aws_region>.amazonaws.com

    443, 80

    允许以标签的形式分配 AWS 资源的元数据。

    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 列入允许列表:

    URLport功能

    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的身份验证

    Operator 需要路由访问权限来执行健康检查。特别是,身份验证和 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 列入允许的可选第三方内容:

    URLport功能

    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 Big IP operator 是必需的。

  7. 如果您使用默认的红帽网络时间协议(NTP)服务器允许以下 URL:

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

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