搜索

第 12 章 配置端点

download PDF

了解如何使用 YAML 配置文件为 Red Hat Advanced Cluster Security for Kubernetes (RHACS)配置端点。

您可以使用 YAML 配置文件来配置公开的端点。您可以使用此配置文件为 Red Hat Advanced Cluster Security for Kubernetes 定义一个或多个端点,并自定义每个端点的 TLS 设置,或为特定端点禁用 TLS。您还可以定义是否需要客户端身份验证,以及要接受哪些客户端证书。

12.1. 自定义 YAML 配置

Red Hat Advanced Cluster Security for Kubernetes 使用 YAML 配置作为 ConfigMap,以便更轻松地更改和管理配置。

使用自定义 YAML 配置文件时,您可以为每个端点配置以下内容:

  • 要使用的协议,如 HTTPgRPC 或两者。
  • 启用或禁用 TLS。
  • 指定服务器证书。
  • 要信任客户端身份验证的客户端证书颁发机构(CA)。
  • 指定是否需要客户端证书身份验证(mTLS)。

您可以使用配置文件在安装过程中或现有 Red Hat Advanced Cluster Security for Kubernetes 实例指定端点。但是,如果您公开除默认端口 8443 以外的任何其他端口,您必须创建允许这些额外端口上流量的网络策略。

以下是 Red Hat Advanced Cluster Security for Kubernetes 的 endpoint .yaml 配置文件示例:

# Sample endpoints.yaml configuration for Central.
#
# # CAREFUL: If the following line is uncommented, do not expose the default endpoint on port 8443 by default.
# #          This will break normal operation.
# disableDefault: true # if true, do not serve on :8443 1
endpoints: 2
  # Serve plaintext HTTP only on port 8080
  - listen: ":8080" 3
    # Backend protocols, possible values are 'http' and 'grpc'. If unset or empty, assume both.
    protocols: 4
      - http
    tls: 5
      # Disable TLS. If this is not specified, assume TLS is enabled.
      disable: true 6
  # Serve HTTP and  gRPC for sensors only on port 8444
  - listen: ":8444" 7
    tls: 8
      # Which TLS certificates to serve, possible values are 'service' (For  service certificates that Red Hat Advanced Cluster Security for Kubernetes generates)
      # and 'default' (user-configured default TLS certificate). If unset or empty, assume both.
      serverCerts: 9
        - default
        - service
      # Client authentication settings.
      clientAuth: 10
        # Enforce TLS client authentication. If unset, do not enforce, only request certificates
        # opportunistically.
        required: true 11
        # Which TLS client CAs to serve, possible values are 'service' (CA for service
        # certificates that Red Hat Advanced Cluster Security for Kubernetes generates) and 'user' (CAs for PKI auth providers). If unset or empty, assume both.
        certAuthorities: 12
        # if not set, assume ["user", "service"]
          - service
1
使用 true 禁用默认端口号 8443 的风险。默认值为 false; 将它改为 true 可能会破坏现有功能。
2
用于公开 Central 的额外端点列表。
3 7
要侦听的地址和端口号。如果使用 端点,则必须指定这个值。您可以使用格式 端口:port,或 address:port 来指定值。例如,
  • 8080:8080 - 监听所有接口中的端口 8080
  • 0.0.0.0:8080 - 监听所有 IPv4 (非 IPv6)接口上的端口 8080
  • 127.0.0.1:8080 - 仅监听本地回送设备上的端口 8080
4
用于指定端点的协议。可接受值为 httpgrpc。如果没有指定值,则 Central 侦听指定端口上的 HTTP 和 gRPC 流量。如果要只为 RHACS 门户公开端点,请使用 http。但是,您将无法将端点用于服务到服务通信或 roxctl CLI,因为这些客户端需要 gRPC 和 HTTP。红帽建议不要指定这个键的值,为端点启用 HTTP 和 gRPC 协议。如果只想将端点限制为 Red Hat Advanced Cluster Security for Kubernetes 服务,请使用 clientAuth 选项。
5 8
使用它来指定端点的 TLS 设置。如果没有指定值,Red Hat Advanced Cluster Security for Kubernetes 会使用以下所有嵌套键的默认设置启用 TLS。
6
使用 true 在指定端点中禁用 TLS。默认值为 false。当设置为 true 时,您无法为 serverCertsclientAuth 指定值。
9
指定配置服务器 TLS 证书的源列表。serverCerts 列表是独立于顺序的,这意味着列表中的第一个项目决定了 Central 默认使用的证书,如果没有匹配的 SNI (服务器名称 Indication)。您可以使用此选项指定多个证书,Central 会自动根据 SNI 选择正确的证书。可接受值为:
  • 默认 :如果已存在,请使用已配置的自定义 TLS 证书。
  • 服务 : 使用 Red Hat Advanced Cluster Security for Kubernetes 生成的内部服务证书。
10
使用它来配置启用了 TLS 的端点客户端证书身份验证的行为。
11
使用 true 只允许具有有效客户端证书的客户端。默认值为 false。您可以将 true 与服务的 certAuthorities 设置一起使用,以便只允许 Red Hat Advanced Cluster Security for Kubernetes 服务连接到此端点。
12
验证客户端证书的 CA 列表。默认值为 ["service", "user"]certAuthorities 列表是按顺序独立的,这意味着此列表中项目的位置无关紧要。另外,将它设置为空 list [] 会禁用端点的客户端证书身份验证,这与保留这个值未设置不同。可接受值为:
  • Service: Red Hat Advanced Cluster Security for Kubernetes 生成的服务证书的 CA。
  • 用户 :由 PKI 身份验证提供程序配置的 CA。
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.