使用 Load Balancer 配置胶囊


Red Hat Satellite 6.13

在胶囊服务器间分布负载

Red Hat Satellite Documentation Team

摘要

本指南论述了如何将 Red Hat Satellite 配置为使用负载均衡器在胶囊服务器之间分布负载。

向红帽文档提供反馈

我们感谢您对我们文档的反馈。让我们了解如何改进它。

使用 Red Hat JIRA 中的 Create Issue 表单提供您的反馈。JIRA 问题在 Red Hat Satellite Jira 项目中创建,您可以在其中跟踪其进度。

前提条件

流程

  1. 单击以下链接: 创建问题。如果 Jira 显示登录错误,则登录并在您重定向到表单后继续。
  2. 完成 SummaryDescription 字段。在 Description 字段中,包含文档 URL、章节号以及问题的详细描述。不要修改表单中的任何其他字段。
  3. Create

第 1 章 负载均衡解决方案架构

您可以将卫星服务器配置为使用负载平衡器来在多个胶囊服务器之间分发客户端请求和网络负载。这会在胶囊服务器上实现整体性能改进。

本指南概述了如何为卫星服务器和胶囊式服务器准备负载平衡,并提供如何配置负载平衡器并在负载平衡设置中注册客户端的说明。

负载均衡设置由以下组件组成:

  • Satellite Server
  • 两个或多个胶囊服务器
  • 负载均衡器
  • 多个客户端

图 1.1. Satellite Load Balancing 解决方案架构

在负载平衡设置中,当一个胶囊式服务器停机时,几乎所有的胶囊功能都能继续按预期工作,以进行计划或计划外的维护。负载均衡器与以下服务和功能一起工作:

  • 使用 subscription-manager进行注册
  • 使用 yum 软件仓库进行内容管理
  • 可选:Puppet
注意

在负载均衡设置中,负载均衡器只为上述服务和功能分发负载。如果置备或 virt-who 等其他服务正在单独的胶囊上运行,则必须直接通过 Capsules 访问它们,而不是通过负载均衡器访问。

管理 Puppet 限制

Puppet 证书颁发机构(CA)管理不支持负载平衡设置中的证书签名请求。Puppet CA 将证书信息(如序列号计数器和 CRL)存储在文件系统中。尝试使用相同数据的多个写入器进程可能会损坏。

要管理此 Puppet 限制,请完成以下步骤:

  1. 在一个胶囊服务器上配置 Puppet 证书签名请求,通常是您要配置胶囊式服务器进行负载平衡的第一个系统。
  2. 配置客户端,将 CA 请求发送到负载均衡器上的端口 8141。
  3. 配置负载平衡器,以将来自端口 8141 的 CA 请求重定向到您配置一台的系统上的端口 8140,以签署 Puppet 证书。

第 2 章 负载均衡注意事项

在几个胶囊服务器之间分布负载可防止任何一个胶囊成为单一故障点。将胶囊配置为使用负载均衡器可提供针对计划和计划外中断的弹性。这提高了可用性和响应能力。

在配置负载平衡时请考虑以下指南:

  • 如果使用 Puppet,则 Puppet 证书签名请求将分配给您配置的第一个胶囊。如果第一个胶囊为 down,客户端无法获取 Puppet 内容。
  • 这个解决方案不使用 Pacemaker 或其他类似的 HA 工具来在所有胶囊中维护一个状态。若要对问题进行故障排除,请绕过负载平衡器,在每个胶囊上重现问题。

负载均衡需要额外的维护

配置胶囊以使用负载均衡器会导致更复杂的环境,需要额外的维护。

负载平衡需要以下附加步骤:

  • 您必须确保所有 Capsules 具有相同的内容视图,并将所有胶囊同步到相同的内容视图版本
  • 您必须按顺序升级每个胶囊
  • 您必须备份您定期配置的每个胶囊

在负载平衡配置中升级胶囊服务器

要将 Capsule 服务器从 6.12 升级到 6.13,请完成 升级和更新 Red Hat Satellite 中的 升级 胶囊服务器 流程。在负载平衡配置中,名称服务器不需要额外的步骤。

要为负载平衡配置 Capsule 服务器,请完成以下步骤,请参阅安装 Capsule 服务器。Satellite 不支持为负载平衡配置现有胶囊服务器。

第 4 章 为负载平衡配置胶囊服务器

本章概述了如何配置胶囊服务器以进行负载平衡。根据您的 Satellite 服务器配置,继续以下部分之一:

为 Katello 证书使用不同的文件名,用于每个胶囊服务器创建。例如,将证书存档文件命名为 FQDN。

下面的部分论述了如何配置使用默认 SSL 证书进行负载平衡的胶囊式服务器,而无需 Puppet。在您要为负载平衡配置的每个胶囊服务器上完成这个步骤。

流程

  1. 在 Satellite 服务器中,为 Capsule 服务器生成 Katello 证书:

    # capsule-certs-generate \
    --certs-tar "/root/capsule.example.com-certs.tar" \
    --foreman-proxy-cname loadbalancer.example.com \
    --foreman-proxy-fqdn capsule.example.com
    Copy to Clipboard Toggle word wrap

    保留示例 satellite-installer 命令的副本,它由 Capsule -certs-generate 命令输出,用于安装 Capsule Server 证书。

  2. 将证书存档文件从卫星服务器复制到胶囊服务器。

    # scp /root/capsule.example.com-certs.tar root@capsule.example.com:/root/capsule.example.com-certs.tar
    Copy to Clipboard Toggle word wrap
  3. 在从 Capsule- certs-generate 命令的输出中获取的 satellite- installer 命令中附加以下选项:

    --certs-cname "loadbalancer.example.com" \
    --enable-foreman-proxy-plugin-remote-execution-script
    Copy to Clipboard Toggle word wrap
  4. 在 Capsule 服务器上,输入 satellite-installer 命令:

    # satellite-installer --scenario capsule \
    --certs-cname "loadbalancer.example.com" \
    --certs-tar-file "capsule.example.com-certs.tar" \
    --enable-foreman-proxy-plugin-remote-execution-script \
    --foreman-proxy-foreman-base-url "https://satellite.example.com" \
    --foreman-proxy-oauth-consumer-key "oauth key" \
    --foreman-proxy-oauth-consumer-secret "oauth secret" \
    --foreman-proxy-register-in-foreman "true" \
    --foreman-proxy-trusted-hosts "satellite.example.com" \
    --foreman-proxy-trusted-hosts "capsule.example.com"
    Copy to Clipboard Toggle word wrap

下面的部分论述了如何配置使用默认 SSL 证书进行负载平衡的胶囊式服务器。

如果在 Satellite 配置中使用 Puppet,您必须完成以下步骤:

仅针对您要配置胶囊服务器的系统完成此步骤,并为您配置用于负载平衡的所有其他胶囊服务器生成和签署 Puppet 证书。

流程

  1. 在卫星服务器上,为您要配置胶囊式服务器的系统生成 Katello 证书,以生成和签署 Puppet 证书:

    # capsule-certs-generate \
    --certs-tar "/root/capsule-ca.example.com-certs.tar" \
    --foreman-proxy-cname loadbalancer.example.com \
    --foreman-proxy-fqdn capsule-ca.example.com
    Copy to Clipboard Toggle word wrap

    保留示例 satellite-installer 命令的副本,它由 Capsule -certs-generate 命令输出,用于安装 Capsule Server 证书。

  2. 将证书存档文件从 Satellite 服务器复制到 Capsule 服务器:

    # scp /root/capsule-ca.example.com-certs.tar root@capsule-ca.example.com:capsule-ca.example.com-certs.tar
    Copy to Clipboard Toggle word wrap
  3. 在从 Capsule- certs-generate 命令的输出中获取的 satellite- installer 命令中附加以下选项:

    --certs-cname "loadbalancer.example.com" \
    --enable-foreman-proxy-plugin-remote-execution-script \
    --foreman-proxy-puppetca "true" \
    --puppet-ca-server "capsule-ca.example.com" \
    --puppet-dns-alt-names "loadbalancer.example.com" \
    --puppet-server-ca "true"
    Copy to Clipboard Toggle word wrap
  4. 在 Capsule 服务器上,输入 satellite-installer 命令:

    # satellite-installer --scenario capsule \
    --certs-cname "loadbalancer.example.com" \
    --certs-tar-file "capsule-ca.example.com-certs.tar" \
    --enable-foreman-proxy-plugin-remote-execution-script \
    --enable-puppet \
    --foreman-proxy-foreman-base-url "https://satellite.example.com" \
    --foreman-proxy-oauth-consumer-key "oauth key" \
    --foreman-proxy-oauth-consumer-secret "oauth secret" \
    --foreman-proxy-puppetca "true" \
    --foreman-proxy-register-in-foreman "true" \
    --foreman-proxy-trusted-hosts "satellite.example.com" \
    --foreman-proxy-trusted-hosts "capsule-ca.example.com" \
    --puppet-ca-server "capsule-ca.example.com" \
    --puppet-dns-alt-names "loadbalancer.example.com" \
    --puppet-server true \
    --puppet-server-ca "true" \
    --puppet-server-foreman-url "https://satellite.example.com"
    Copy to Clipboard Toggle word wrap
  5. 在作为 Puppetserver 证书颁发机构的 Capsule 服务器上,停止 Puppet 服务器:

    # systemctl stop puppetserver
    Copy to Clipboard Toggle word wrap
  6. 为您配置的所有其他胶囊服务器生成 Puppet 证书,除了第一个配置 Puppet 证书签名请求的系统外:

    # puppetserver ca generate \
    --ca-client \
    --certname capsule.example.com \
    --subject-alt-names loadbalancer.example.com
    Copy to Clipboard Toggle word wrap

    这个命令会创建以下文件:

    • /etc/puppetlabs/puppet/ssl/certs/capsule.example.com.pem
    • /etc/puppetlabs/puppet/ssl/private_keys/capsule.example.com.pem
    • /etc/puppetlabs/puppet/ssl/public_keys/capsule.example.com.pem
    • /etc/puppetlabs/puppetserver/ca/signed/capsule.example.com.pem
  7. 启动 Puppet 服务器:

    # systemctl start puppetserver
    Copy to Clipboard Toggle word wrap

在每个胶囊服务器上完成此步骤,排除您配置胶囊式服务器的系统以签署 Puppet 证书。

流程

  1. 在 Satellite 服务器中,为 Capsule 服务器生成 Katello 证书:

    # capsule-certs-generate \
    --certs-tar "/root/capsule.example.com-certs.tar" \
    --foreman-proxy-cname loadbalancer.example.com \
    --foreman-proxy-fqdn capsule.example.com
    Copy to Clipboard Toggle word wrap

    保留示例 satellite-installer 命令的副本,它由 Capsule -certs-generate 命令输出,用于安装 Capsule Server 证书。

  2. 将证书存档文件从 Satellite 服务器复制到 Capsule 服务器:

    # scp /root/capsule.example.com-certs.tar root@capsule.example.com:/root/capsule.example.com-certs.tar
    Copy to Clipboard Toggle word wrap
  3. 在 Capsule 服务器上,安装 puppetserver 软件包:

    # satellite-maintain packages install puppetserver
    Copy to Clipboard Toggle word wrap
  4. 在胶囊服务器上,为 puppet 证书创建目录:

    # mkdir -p /etc/puppetlabs/puppet/ssl/certs/ \
    /etc/puppetlabs/puppet/ssl/private_keys/ \
    /etc/puppetlabs/puppet/ssl/public_keys/
    Copy to Clipboard Toggle word wrap
  5. 在胶囊服务器上,从您配置胶囊式服务器的系统中复制此胶囊服务器的 Puppet 证书,以签署 Puppet 证书:

    # scp root@capsule-ca.example.com:/etc/puppetlabs/puppet/ssl/certs/capsule.example.com.pem /etc/puppetlabs/puppet/ssl/certs/capsule.example.com.pem
    # scp root@capsule-ca.example.com:/etc/puppetlabs/puppet/ssl/certs/ca.pem /etc/puppetlabs/puppet/ssl/certs/ca.pem
    # scp root@capsule-ca.example.com:/etc/puppetlabs/puppet/ssl/private_keys/capsule.example.com.pem /etc/puppetlabs/puppet/ssl/private_keys/capsule.example.com.pem
    # scp root@capsule-ca.example.com:/etc/puppetlabs/puppet/ssl/public_keys/capsule.example.com.pem /etc/puppetlabs/puppet/ssl/public_keys/capsule.example.com.pem
    Copy to Clipboard Toggle word wrap
  6. 在 Capsule 服务器上,将 /etc/puppetlabs/puppet/ssl/ 目录所有权改为 user puppet 和 group puppet

    # chown -R puppet:puppet /etc/puppetlabs/puppet/ssl/
    Copy to Clipboard Toggle word wrap
  7. 在 Capsule 服务器上,为 /etc/puppetlabs/puppet/ssl/ 目录设置 SELinux 上下文:

    # restorecon -Rv /etc/puppetlabs/puppet/ssl/
    Copy to Clipboard Toggle word wrap
  8. 在从 Capsule- certs-generate 命令的输出中获取的 satellite- installer 命令中附加以下选项:

    --certs-cname "loadbalancer.example.com" \
    --enable-foreman-proxy-plugin-remote-execution-script \
    --foreman-proxy-puppetca "false" \
    --puppet-ca-server "capsule-ca.example.com" \
    --puppet-dns-alt-names "loadbalancer.example.com" \
    --puppet-server-ca "false"
    Copy to Clipboard Toggle word wrap
  9. 在 Capsule 服务器上,输入 satellite-installer 命令:

    # satellite-installer --scenario capsule \
    --certs-cname "loadbalancer.example.com" \
    --certs-tar-file "capsule.example.com-certs.tar" \
    --enable-foreman-proxy-plugin-remote-execution-script \
    --foreman-proxy-foreman-base-url "https://satellite.example.com" \
    --foreman-proxy-oauth-consumer-key "oauth key" \
    --foreman-proxy-oauth-consumer-secret "oauth secret" \
    --foreman-proxy-puppetca "false" \
    --foreman-proxy-register-in-foreman "true" \
    --foreman-proxy-trusted-hosts "satellite.example.com" \
    --foreman-proxy-trusted-hosts "capsule.example.com" \
    --puppet-ca-server "capsule-ca.example.com" \
    --puppet-dns-alt-names "loadbalancer.example.com" \
    --puppet-server-ca "false" \
    --puppet-server-foreman-url "https://satellite.example.com"
    Copy to Clipboard Toggle word wrap

下面的部分论述了如何配置使用自定义 SSL 证书进行负载平衡的胶囊式服务器,而无需 Puppet。

4.3.1. 为胶囊服务器创建自定义 SSL 证书

此流程概述了如何为证书签名请求创建配置文件,并将负载均衡器和胶囊服务器作为主题备用名称(SAN)。在您要为负载平衡配置的每个胶囊服务器上完成这个步骤。

流程

  1. 要存储所有源证书文件,请创建一个只能被 root 用户访问的目录:

    # mkdir /root/capsule_cert
    Copy to Clipboard Toggle word wrap
  2. 创建用于签署证书签名请求(CSR)的私钥。

    请注意,私钥必须未加密。如果您使用受密码保护的私钥,请删除私钥密码。

    如果您已有此胶囊服务器的私钥,请跳过这一步。

    # openssl genrsa -out /root/capsule_cert/capsule_cert_key.pem 4096
    Copy to Clipboard Toggle word wrap
  3. 为 CSR 创建 /root/capsule_cert/openssl.cnf 配置文件并包含以下内容:

    [ req ]
    req_extensions = v3_req
    distinguished_name = req_distinguished_name
    x509_extensions = usr_cert
    prompt = no
    
    [ req_distinguished_name ]
    commonName = capsule.example.com 
    1
    
    
    [ v3_req ]
    basicConstraints = CA:FALSE
    keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
    extendedKeyUsage = serverAuth, clientAuth, codeSigning, emailProtection
    subjectAltName = @alt_names
    
    [alt_names] 
    2
    
    DNS.1 = loadbalancer.example.com
    DNS.2 = capsule.example.com
    Copy to Clipboard Toggle word wrap
    1
    证书的通用名称必须与 Capsule 服务器的 FQDN 匹配。在为负载平衡配置的每个胶囊服务器上运行 命令时,请务必更改此设置。您还可以设置通配符值 *。如果设置通配符值,您必须在使用 katello -certs-check 命令时添加 -t Capsule 选项。
    2
    [alt_names] 下,将负载均衡器的 FQDN 作为 DNS.1,以及 Capsule Server 的 FQDN 作为 DNS.2
  4. 可选:如果要在 CSR 中添加可辨识名称(DN)详情,请在 [ req_distinguished_name ] 部分中添加以下信息:

    [req_distinguished_name]
    CN = capsule.example.com
    countryName =My_Country_Name 
    1
    
    stateOrProvinceName = My_State_Or_Province_Name 
    2
    
    localityName = My_Locality_Name 
    3
    
    organizationName = My_Organization_Or_Company_Name
    organizationalUnitName = My_Organizational_Unit_Name 
    4
    Copy to Clipboard Toggle word wrap
    1
    两个字母代码
    2
    全名
    3
    全名(例如:New York)
    4
    负责证书的部门(示例:IT 部门)
  5. 生成 CSR:

    # openssl req -new \
    -key /root/capsule_cert/capsule_cert_key.pem \ 
    1
    
    -config /root/capsule_cert/openssl.cnf \ 
    2
    
    -out /root/capsule_cert/capsule_cert_csr.pem 
    3
    Copy to Clipboard Toggle word wrap
    1
    私钥的路径
    2
    配置文件的路径
    3
    要生成的 CSR 的路径
  6. 将证书签名请求发送到证书颁发机构(CA)。同一 CA 必须为 Satellite 服务器和胶囊服务器签名证书。

    提交请求时,指定证书的期限。发送证书请求的方法会有所不同,因此请查阅 CA 了解首选方法。根据请求,您可以预期在单独的文件中接收 CA 捆绑包和签名证书。

  7. 将您收到的证书颁发机构捆绑包和胶囊式服务器证书文件和胶囊式服务器私钥复制到卫星服务器。
  8. 在管理门户中,验证 Capsule Server 证书输入文件:
# katello-certs-check \
-c /root/{cert-name}_cert/{cert-name}_cert.pem \ 
1

-k /root/{cert-name}_cert/{cert-name}_cert_key.pem \ 
2

-b /root/{cert-name}_cert/ca_cert_bundle.pem 
3
Copy to Clipboard Toggle word wrap
1
Capsule Server 证书文件,由您的证书颁发机构提供
2
胶囊式服务器的私钥,用于签署证书
3
由您的证书颁发机构提供的证书颁发机构捆绑包

如果将 commonName= 设置为通配符值 *,您必须将 -t Capsule 选项添加到 katello-certs-check 命令中。

保留示例 Capsule -certs-generate 命令的副本,它由 katello-certs-check 命令的输出,以用于为这个 Capsule 服务器创建证书归档文件。

下面的部分论述了如何配置使用自定义 SSL 证书进行负载平衡的胶囊式服务器,而无需 Puppet。在您要为负载平衡配置的每个胶囊服务器上完成这个步骤。

流程

  1. 在 Capsule -certs-generate 命令中附加以下选项,您从 katello-certs-check 命令的输出中获取:

    --foreman-proxy-cname loadbalancer.example.com
    Copy to Clipboard Toggle word wrap
  2. 在 Satellite 服务器上,输入 evince-certs-generate 命令以生成 Capsule 证书:

    # capsule-certs-generate \
    --certs-tar /root/capsule_cert/capsule.tar \
    --foreman-proxy-cname loadbalancer.example.com \
    --foreman-proxy-fqdn capsule.example.com \
    --server-ca-cert /root/capsule_cert/ca_cert_bundle.pem \
    --server-cert /root/capsule_cert/capsule.pem \
    --server-key /root/capsule_cert/capsule.pem
    Copy to Clipboard Toggle word wrap

    从安装 Capsule 服务器证书的输出中保留示例 satellite-installer 命令的副本。

  3. 将证书存档文件从 Satellite 服务器复制到 Capsule 服务器:

    # scp /root/capsule.example.com-certs.tar root@capsule.example.com:capsule.example.com-certs.tar
    Copy to Clipboard Toggle word wrap
  4. 在从 Capsule- certs-generate 命令的输出中获取的 satellite- installer 命令中附加以下选项:

    --certs-cname "loadbalancer.example.com" \
    --enable-foreman-proxy-plugin-remote-execution-script
    Copy to Clipboard Toggle word wrap
  5. 在 Capsule 服务器上,输入 satellite-installer 命令:

    # satellite-installer --scenario capsule \
    --certs-cname "loadbalancer.example.com" \
    --certs-tar-file "capsule.example.com-certs.tar" \
    --enable-foreman-proxy-plugin-remote-execution-script \
    --foreman-proxy-foreman-base-url "https://satellite.example.com" \
    --foreman-proxy-oauth-consumer-key "oauth key" \
    --foreman-proxy-oauth-consumer-secret "oauth secret" \
    --foreman-proxy-register-in-foreman "true" \
    --foreman-proxy-trusted-hosts "satellite.example.com" \
    --foreman-proxy-trusted-hosts "capsule.example.com"
    Copy to Clipboard Toggle word wrap

如果在 Satellite 配置中使用 Puppet,则必须完成以下步骤:

4.4.1. 为胶囊服务器创建自定义 SSL 证书

此流程概述了如何为证书签名请求创建配置文件,并将负载均衡器和胶囊服务器作为主题备用名称(SAN)。在您要为负载平衡配置的每个胶囊服务器上完成这个步骤。

流程

  1. 要存储所有源证书文件,请创建一个只能被 root 用户访问的目录:

    # mkdir /root/capsule_cert
    Copy to Clipboard Toggle word wrap
  2. 创建用于签署证书签名请求(CSR)的私钥。

    请注意,私钥必须未加密。如果您使用受密码保护的私钥,请删除私钥密码。

    如果您已有此胶囊服务器的私钥,请跳过这一步。

    # openssl genrsa -out /root/capsule_cert/capsule_cert_key.pem 4096
    Copy to Clipboard Toggle word wrap
  3. 为 CSR 创建 /root/capsule_cert/openssl.cnf 配置文件并包含以下内容:

    [ req ]
    req_extensions = v3_req
    distinguished_name = req_distinguished_name
    x509_extensions = usr_cert
    prompt = no
    
    [ req_distinguished_name ]
    commonName = capsule.example.com 
    1
    
    
    [ v3_req ]
    basicConstraints = CA:FALSE
    keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
    extendedKeyUsage = serverAuth, clientAuth, codeSigning, emailProtection
    subjectAltName = @alt_names
    
    [alt_names] 
    2
    
    DNS.1 = loadbalancer.example.com
    DNS.2 = capsule.example.com
    Copy to Clipboard Toggle word wrap
    1
    证书的通用名称必须与 Capsule 服务器的 FQDN 匹配。在为负载平衡配置的每个胶囊服务器上运行 命令时,请务必更改此设置。您还可以设置通配符值 *。如果设置通配符值,您必须在使用 katello -certs-check 命令时添加 -t Capsule 选项。
    2
    [alt_names] 下,将负载均衡器的 FQDN 作为 DNS.1,以及 Capsule Server 的 FQDN 作为 DNS.2
  4. 可选:如果要在 CSR 中添加可辨识名称(DN)详情,请在 [ req_distinguished_name ] 部分中添加以下信息:

    [req_distinguished_name]
    CN = capsule.example.com
    countryName =My_Country_Name 
    1
    
    stateOrProvinceName = My_State_Or_Province_Name 
    2
    
    localityName = My_Locality_Name 
    3
    
    organizationName = My_Organization_Or_Company_Name
    organizationalUnitName = My_Organizational_Unit_Name 
    4
    Copy to Clipboard Toggle word wrap
    1
    两个字母代码
    2
    全名
    3
    全名(例如:New York)
    4
    负责证书的部门(示例:IT 部门)
  5. 生成 CSR:

    # openssl req -new \
    -key /root/capsule_cert/capsule_cert_key.pem \ 
    1
    
    -config /root/capsule_cert/openssl.cnf \ 
    2
    
    -out /root/capsule_cert/capsule_cert_csr.pem 
    3
    Copy to Clipboard Toggle word wrap
    1
    私钥的路径
    2
    配置文件的路径
    3
    要生成的 CSR 的路径
  6. 将证书签名请求发送到证书颁发机构(CA)。同一 CA 必须为 Satellite 服务器和胶囊服务器签名证书。

    提交请求时,指定证书的期限。发送证书请求的方法会有所不同,因此请查阅 CA 了解首选方法。根据请求,您可以预期在单独的文件中接收 CA 捆绑包和签名证书。

  7. 将您收到的证书颁发机构捆绑包和胶囊式服务器证书文件和胶囊式服务器私钥复制到卫星服务器。
  8. 在管理门户中,验证 Capsule Server 证书输入文件:
# katello-certs-check \
-c /root/{cert-name}_cert/{cert-name}_cert.pem \ 
1

-k /root/{cert-name}_cert/{cert-name}_cert_key.pem \ 
2

-b /root/{cert-name}_cert/ca_cert_bundle.pem 
3
Copy to Clipboard Toggle word wrap
1
Capsule Server 证书文件,由您的证书颁发机构提供
2
胶囊式服务器的私钥,用于签署证书
3
由您的证书颁发机构提供的证书颁发机构捆绑包

如果将 commonName= 设置为通配符值 *,您必须将 -t Capsule 选项添加到 katello-certs-check 命令中。

保留示例 Capsule -certs-generate 命令的副本,它由 katello-certs-check 命令的输出,以用于为这个 Capsule 服务器创建证书归档文件。

仅针对您要配置胶囊服务器的系统完成此流程,以便为您配置用于负载均衡的所有其他胶囊服务器生成 Puppet 证书。

流程

  1. 在 Capsule -certs-generate 命令中附加以下选项,您从 katello-certs-check 命令的输出中获取:

    --foreman-proxy-cname loadbalancer.example.com
    Copy to Clipboard Toggle word wrap
  2. 在 Satellite 服务器上,输入 evince-certs-generate 命令以生成 Capsule 证书:

    # capsule-certs-generate \
    --certs-tar /root/capsule_cert/capsule-ca.tar \
    --foreman-proxy-cname loadbalancer.example.com \
    --foreman-proxy-fqdn capsule-ca.example.com \
    --server-ca-cert /root/capsule_cert/ca_cert_bundle.pem \
    --server-cert /root/capsule_cert/capsule-ca.pem \
    --server-key /root/capsule_cert/capsule-ca.pem
    Copy to Clipboard Toggle word wrap

    从安装 Capsule 服务器证书的输出中保留示例 satellite-installer 命令的副本。

  3. 将证书存档文件从卫星服务器复制到胶囊服务器。
  4. 在从 Capsule- certs-generate 命令的输出中获取的 satellite- installer 命令中附加以下选项:

    --enable-foreman-proxy-plugin-remote-execution-script \
    --foreman-proxy-puppetca "true" \
    --puppet-ca-server "capsule-ca.example.com" \
    --puppet-dns-alt-names "loadbalancer.example.com" \
    --puppet-server-ca "true"
    Copy to Clipboard Toggle word wrap
  5. 在 Capsule 服务器上,输入 satellite-installer 命令:

    # satellite-installer --scenario capsule \
    --certs-cname "loadbalancer.example.com" \
    --certs-tar-file "certs.tgz" \
    --enable-foreman-proxy-plugin-remote-execution-script \
    --enable-puppet \
    --foreman-proxy-foreman-base-url "https://satellite.example.com" \
    --foreman-proxy-oauth-consumer-key "oauth key" \
    --foreman-proxy-oauth-consumer-secret "oauth secret" \
    --foreman-proxy-puppetca "true" \
    --foreman-proxy-register-in-foreman "true" \
    --foreman-proxy-trusted-hosts "satellite.example.com" \
    --foreman-proxy-trusted-hosts "capsule-ca.example.com" \
    --puppet-ca-server "capsule-ca.example.com" \
    --puppet-dns-alt-names "loadbalancer.example.com" \
    --puppet-server true \
    --puppet-server-ca "true" \
    --puppet-server-foreman-url "https://satellite.example.com"
    Copy to Clipboard Toggle word wrap
  6. 在作为 Puppetserver 证书颁发机构的 Capsule 服务器上,停止 Puppet 服务器:

    # systemctl stop puppetserver
    Copy to Clipboard Toggle word wrap
  7. 为您配置的所有其他胶囊服务器生成 Puppet 证书,除了第一个配置 Puppet 证书签名请求的系统外:

    # puppetserver ca generate \
    --ca-client \
    --certname capsule.example.com \
    --subject-alt-names loadbalancer.example.com
    Copy to Clipboard Toggle word wrap

    这个命令会创建以下文件:

    • /etc/puppetlabs/puppet/ssl/certs/capsule.example.com.pem
    • /etc/puppetlabs/puppet/ssl/private_keys/capsule.example.com.pem
    • /etc/puppetlabs/puppet/ssl/public_keys/capsule.example.com.pem
    • /etc/puppetlabs/puppetserver/ca/signed/capsule.example.com.pem
  8. 启动 Puppet 服务器:

    # systemctl start puppetserver
    Copy to Clipboard Toggle word wrap

为每个胶囊服务器完成此步骤,不包括您配置胶囊式服务器以签署 Puppet 证书的系统。

流程

  1. 在 Capsule -certs-generate 命令中附加以下选项,您从 katello-certs-check 命令的输出中获取:

    --foreman-proxy-cname loadbalancer.example.com
    Copy to Clipboard Toggle word wrap
  2. 在 Satellite 服务器上,输入 evince-certs-generate 命令以生成 Capsule 证书:

    # capsule-certs-generate \
    --certs-tar /root/capsule_cert/capsule.tar \
    --foreman-proxy-cname loadbalancer.example.com \
    --foreman-proxy-fqdn capsule.example.com \
    --server-ca-cert /root/capsule_cert/ca_cert_bundle.pem \
    --server-cert /root/capsule_cert/capsule.pem \
    --server-key /root/capsule_cert/capsule.pem
    Copy to Clipboard Toggle word wrap

    从安装 Capsule 服务器证书的输出中保留示例 satellite-installer 命令的副本。

  3. 将证书存档文件从卫星服务器复制到胶囊服务器。

    # scp /root/capsule.example.com-certs.tar root@capsule.example.com:capsule.example.com-certs.tar
    Copy to Clipboard Toggle word wrap
  4. 在 Capsule 服务器上,安装 puppetserver 软件包:

    # satellite-maintain packages install puppetserver
    Copy to Clipboard Toggle word wrap
  5. 在胶囊服务器上,为 puppet 证书创建目录:

    # mkdir -p /etc/puppetlabs/puppet/ssl/certs/ \
    /etc/puppetlabs/puppet/ssl/private_keys/ \
    /etc/puppetlabs/puppet/ssl/public_keys/
    Copy to Clipboard Toggle word wrap
  6. 在胶囊服务器上,从您配置胶囊式服务器的系统中复制此胶囊服务器的 Puppet 证书,以签署 Puppet 证书:

    # scp root@capsule-ca.example.com:/etc/puppetlabs/puppet/ssl/certs/capsule.example.com.pem /etc/puppetlabs/puppet/ssl/certs/capsule.example.com.pem
    # scp root@capsule-ca.example.com:/etc/puppetlabs/puppet/ssl/certs/ca.pem /etc/puppetlabs/puppet/ssl/certs/ca.pem
    # scp root@capsule-ca.example.com:/etc/puppetlabs/puppet/ssl/private_keys/capsule.example.com.pem /etc/puppetlabs/puppet/ssl/private_keys/capsule.example.com.pem
    # scp root@capsule-ca.example.com:/etc/puppetlabs/puppet/ssl/public_keys/capsule.example.com.pem /etc/puppetlabs/puppet/ssl/public_keys/capsule.example.com.pem
    Copy to Clipboard Toggle word wrap
  7. 在 Capsule 服务器上,将 /etc/puppetlabs/puppet/ssl/ 目录所有权改为 user puppet 和 group puppet

    # chown -R puppet:puppet /etc/puppetlabs/puppet/ssl/
    Copy to Clipboard Toggle word wrap
  8. 在 Capsule 服务器上,为 /etc/puppetlabs/puppet/ssl/ 目录设置 SELinux 上下文:

    # restorecon -Rv /etc/puppetlabs/puppet/ssl/
    Copy to Clipboard Toggle word wrap
  9. 在从 Capsule- certs-generate 命令的输出中获取的 satellite- installer 命令中附加以下选项:

    --certs-cname "loadbalancer.example.com" \
    --enable-foreman-proxy-plugin-remote-execution-script \
    --foreman-proxy-puppetca "false" \
    --puppet-ca-server "capsule-ca.example.com" \
    --puppet-dns-alt-names "loadbalancer.example.com" \
    --puppet-server-ca "false"
    Copy to Clipboard Toggle word wrap
  10. 在 Capsule 服务器上,输入 satellite-installer 命令:

    # satellite-installer --scenario capsule \
    --certs-cname "loadbalancer.example.com" \
    --certs-tar-file "capsule.example.com-certs.tar" \
    --enable-foreman-proxy-plugin-remote-execution-script \
    --foreman-proxy-foreman-base-url "https://satellite.example.com" \
    --foreman-proxy-oauth-consumer-key "oauth key" \
    --foreman-proxy-oauth-consumer-secret "oauth secret" \
    --foreman-proxy-puppetca "false" \
    --foreman-proxy-register-in-foreman "true" \
    --foreman-proxy-trusted-hosts "satellite.example.com" \
    --foreman-proxy-trusted-hosts "capsule.example.com" \
    --puppet-ca-server "capsule-ca.example.com" \
    --puppet-dns-alt-names "loadbalancer.example.com" \
    --puppet-server-ca "false" \
    --puppet-server-foreman-url "https://satellite.example.com"
    Copy to Clipboard Toggle word wrap

第 5 章 为主机注册设置负载平衡器

您可以使用主机注册功能,将 Satellite 配置为通过负载平衡器注册客户端。

您将能够将主机注册到负载平衡器,而非胶囊。负载平衡器将决定通过哪个胶囊在请求时注册主机。注册后,主机上的订阅管理器将被配置为通过负载均衡器管理内容。

前提条件

  • 在所有胶囊服务器上配置了 SSL 证书。如需更多信息,请参阅 第 4 章 为负载平衡配置胶囊服务器
  • 在所有胶囊服务器上启用了注册和模板插件:

    # satellite-installer --scenario capsule \
    --foreman-proxy-registration true \
    --foreman-proxy-templates true
    Copy to Clipboard Toggle word wrap

流程

  1. 在所有胶囊服务器上,使用 satellite-installer 设置注册和模板 URL:

    # satellite-installer --scenario capsule \
    --foreman-proxy-registration-url "https://loadbalancer.example.com:9090" \
    --foreman-proxy-template-url "http://loadbalancer.example.com:8000"
    Copy to Clipboard Toggle word wrap
  2. 在 Satellite Web UI 中,导航到 Infrastructure > Capsules
  3. 对于每个胶囊,单击 Actions 栏中的下拉菜单,再选择 Refresh

第 6 章 安装 Load Balancer

以下示例提供有关使用 Red Hat Enterprise Linux 8 服务器配置 HAProxy 负载均衡器的通用指导。但是,您可以安装支持 TCP 转发的任何合适的负载均衡软件解决方案。

流程

  1. 安装 HAProxy:

    # dnf install haproxy
    Copy to Clipboard Toggle word wrap
  2. 安装包含 semanage 工具的以下软件包:

    # dnf install policycoreutils-python-utils
    Copy to Clipboard Toggle word wrap
  3. 配置 SELinux 以允许 HAProxy 绑定任何端口:

    # semanage boolean --modify --on haproxy_connect_any
    Copy to Clipboard Toggle word wrap
  4. 配置负载均衡器以平衡端口的网络负载,如 表 6.1 “Load Balancer 的端口配置” 所述。例如,要为 HAProxy 配置端口,请编辑 /etc/haproxy/haproxy.cfg 文件,使其与表对应。如需更多信息,请参阅红帽知识库中的 带有 Satellite 6 的 HAProxy 负载均衡器的 haproxy.cfg 配置示例

    Expand
    表 6.1. Load Balancer 的端口配置
    服务端口模式平衡模式目的地

    HTTP

    80

    TCP

    roundrobin

    所有胶囊服务器上的端口 80

    HTTPS 和 RHSM

    443

    TCP

    source

    所有胶囊服务器上的端口 443

    AMQP

    5647

    TCP

    roundrobin

    所有胶囊服务器上的端口 5647

    用于模板检索的 Anaconda

    8000

    TCP

    roundrobin

    所有胶囊服务器上的端口 8000

    Puppet (可选)

    8140

    TCP

    roundrobin

    所有胶囊服务器上的端口 8140

    PuppetCA (可选)

    8141

    TCP

    roundrobin

    端口 8140 仅在您配置胶囊服务器以签署 Puppet 证书的系统上

    用于主机注册和可选 OpenSCAP 的 Capsule HTTPS

    9090

    TCP

    roundrobin

    所有胶囊服务器上的端口 9090

  5. 配置负载均衡器以禁用 SSL 卸载并允许客户端 SSL 证书传递给后端服务器。这是必要的,因为从客户端到胶囊服务器的通信取决于客户端 SSL 证书。
  6. 启动并启用 HAProxy 服务:

    # systemctl enable --now haproxy
    Copy to Clipboard Toggle word wrap

第 7 章 验证负载平衡配置

使用这个流程验证每个 Capsule 服务器的负载平衡配置。

流程

  1. 关闭用于您的胶囊服务器的基础操作系统。
  2. 验证内容或订阅管理功能是否在注册到此 Capsule 的客户端中可用。例如,在客户端上输入 subscription-manager refresh 命令。
  3. 重启您的胶囊式服务器的基本操作系统。

第 8 章 将客户端注册到负载均衡器

要平衡来自客户端的网络流量的负载,您必须将客户端注册到负载均衡器。

要注册客户端,请执行以下步骤之一:

8.1. 使用主机注册注册客户端

您可以使用 Satellite Web UI、hammer CLI 或 Satellite API 中的主机注册功能,将主机注册到 Satellite。如需更多信息, 请参阅管理主机中的 注册主机

前提条件

流程

  1. 在 Satellite Web UI 中,导航到 Hosts > Register Host
  2. 胶囊 下拉列表中,选择负载平衡器。
  3. 选择 Force 来注册之前注册到 Capsule Server 的主机。
  4. Activation Keys 列表中,选择要分配给您的主机的激活密钥。
  5. Generate 创建注册命令。
  6. 点击 文件 图标将命令复制到您的剪贴板。
  7. 使用 SSH 连接到您的主机并运行注册命令。
  8. 检查 /etc/yum.repos.d/redhat.repo 文件,并确保启用了适当的软件仓库。

CLI 过程

  1. 使用 Hammer CLI 生成主机注册命令:

    # hammer host-registration generate-command \
    --activation-keys "My_Activation_Key"
    Copy to Clipboard Toggle word wrap

    如果您的主机不信任 Satellite 服务器的 SSL 证书,您可以通过在 registration 命令中添加 --insecure 标志来禁用 SSL 验证。

    # hammer host-registration generate-command \
    --activation-keys "My_Activation_Key" \
    --insecure true
    Copy to Clipboard Toggle word wrap

    包含 --smart-proxy-id Capsule_ID 选项。您可以使用您为主机注册负载平衡配置的任何胶囊服务器的 ID。Satellite 将自动应用负载平衡器到注册命令。

    包含 --force 选项,以注册之前注册到胶囊式服务器的主机。

  2. 使用 SSH 连接到您的主机并运行注册命令。
  3. 检查 /etc/yum.repos.d/redhat.repo 文件,并确保启用了适当的软件仓库。

API 流程

  1. 使用 Satellite API 生成主机注册命令:

    # curl -X POST https://satellite.example.com/api/registration_commands \
    --user "My_User_Name" \
    -H 'Content-Type: application/json' \
    -d '{ "registration_command": { "activation_keys": ["My_Activation_Key_1, My_Activation_Key_2"] }}'
    Copy to Clipboard Toggle word wrap

    如果您的主机不信任 Satellite 服务器的 SSL 证书,您可以通过在 registration 命令中添加 --insecure 标志来禁用 SSL 验证。

    # curl -X POST https://satellite.example.com/api/registration_commands \
    --user "My_User_Name" \
    -H 'Content-Type: application/json' \
    -d '{ "registration_command": { "activation_keys": ["My_Activation_Key_1, My_Activation_Key_2"], "insecure": true }}'
    Copy to Clipboard Toggle word wrap

    使用激活码来简化指定环境。如需更多信息,请参阅管理内容中的管理激活码

    包含 { "smart_proxy_id": Capsule_ID }。您可以使用您为主机注册负载平衡配置的任何胶囊服务器的 ID。Satellite 将自动应用负载平衡器到注册命令。

    包含 { "force": true } 以注册之前注册到 Capsule 服务器的主机。

    要将密码作为命令行参数输入,请使用 username:password 语法。请记住,这可以将密码保存在 shell 历史记录中。或者,您可以使用临时个人访问令牌而不是密码。要在 Satellite Web UI 中生成令牌,请导航到 My Account > Personal Access Tokens

  2. 使用 SSH 连接到您的主机并运行注册命令。
  3. 检查 /etc/yum.repos.d/redhat.repo 文件,并确保启用了适当的软件仓库。

8.2. (已弃用) 使用启动脚本注册客户端

要注册客户端,在客户端上输入以下命令。您必须为每个客户端完成注册过程。

前提条件

流程

  • 在 Red Hat Enterprise Linux 8 中输入以下命令:

    # /usr/libexec/platform-python bootstrap.py \
    --activationkey="My_Activation_Key" \
    --enablerepos=satellite-client-6-for-rhel-8-<arch>-rpms \ 
    1
    
    --force \ 
    2
    
    --hostgroup="My_Hostgroup" \
    --location="My_Location" \
    --login=admin \
    --organization="My_Organization" \
    --puppet-ca-port 8141 \ 
    3
    
    --server loadbalancer.example.com
    Copy to Clipboard Toggle word wrap
    1
    <arch > 替换为客户端架构,如 x86
    2
    包含 --force 选项,以注册之前注册到独立胶囊的客户端。
    3
    如果使用 Puppet,请包含 --puppet-ca-port 8141 选项。
  • 在 Red Hat Enterprise Linux 7 或 6 中输入以下命令:

    # python bootstrap.py --login=admin \
    --activationkey="My_Activation_Key" \
    --enablerepos=rhel-7-server-satellite-client-6-rpms \
    --force \ 
    1
    
    --hostgroup="My_Hostgroup" \
    --location="My_Location" \
    --organization="My_Organization" \
    --puppet-ca-port 8141 \ 
    2
    
    --server loadbalancer.example.com
    Copy to Clipboard Toggle word wrap
    1
    包含 --force 选项,以注册之前注册到独立胶囊的客户端。
    2
    如果使用 Puppet,请包含 --puppet-ca-port 8141 选项。

该脚本提示您输入使用 --login 选项输入的 Satellite 用户名对应的密码。

要手动注册客户端,请在您要注册的每个客户端上完成以下步骤。

流程

  1. 删除 katello-ca-consumer 软件包(如果已安装):

    # dnf remove 'katello-ca-consumer*'
    Copy to Clipboard Toggle word wrap
  2. 从负载均衡器安装 katello-ca-consumer 软件包:

    # dnf install http://loadbalancer.example.com/pub/katello-ca-consumer-latest.noarch.rpm
    Copy to Clipboard Toggle word wrap
  3. 注册客户端,并包含 --serverurl--baseurl 选项:

    # subscription-manager register \
    --activationkey="My_Activation_Key" \
    --baseurl=https://loadbalancer.example.com/pulp/content/ \
    --org="My_Organization" \
    --serverurl=https://loadbalancer.example.com/rhsm
    Copy to Clipboard Toggle word wrap

第 9 章 通过 Load Balancer 传播 SCAP 内容

如果使用 OpenSCAP 来管理客户端的安全合规性,您必须将 SCAP 客户端配置为将 ARF 报告发送到负载均衡器而不是 Capsule。配置过程取决于您选择部署合规策略的方法。

9.1. 使用 Ansible 部署传播 SCAP 内容

使用这个流程,您可以通过 Ansible 部署方法范围内的负载均衡器提升安全内容自动化协议(SCAP)内容。

前提条件

  • 确保您已为 Ansible 部署策略配置了 Satellite。如需更多信息,请参阅管理 Red Hat Satellite 中的 配置合规策略部署方法

流程

  1. 在 Satellite Web UI 中,进入到 Configure > Variables
  2. 搜索 foreman_scap_client_port 变量,再单击其名称。
  3. Default Behavior 区域中,确保选择了 Override 复选框。
  4. Parameter Type 列表中,确保选择了 整数
  5. Default Value 字段中,输入 9090
  6. Specify Matchers 区域中,删除所有覆盖默认值的 matchers。
  7. Submit
  8. 搜索 foreman_scap_client_server 变量,再单击其名称。
  9. Default Behavior 区域中,确保选择了 Override 复选框。
  10. Parameter Type 列表中,确保选择了 字符串
  11. Default Value 字段中,输入负载均衡器的 FQDN,如 loadbalancer.example.com
  12. Specify Matchers 区域中,删除所有覆盖默认值的 matchers。
  13. Submit
  14. 使用 Ansible 继续部署合规策略。如需更多信息,请参阅:

验证

  • 在客户端上,验证 /etc/foreman_scap_client/config.yaml 文件包含以下行:

    # Foreman proxy to which reports should be uploaded
    :server: 'loadbalancer.example.com'
    :port: 9090
    Copy to Clipboard Toggle word wrap

9.2. 使用 Puppet 部署传播 SCAP 内容

使用此流程,您可以通过 Puppet 部署方法范围内的负载均衡器提升安全内容自动化协议(SCAP)内容。

前提条件

  • 确保您为 Puppet 部署策略配置了 Satellite。如需更多信息,请参阅管理 Red Hat Satellite 中的 配置合规策略部署方法

流程

  1. 在 Satellite Web UI 中,导航到 Configure > Classes,再点 foreman_scap_client
  2. 单击 智能类参数 选项卡。
  3. Smart Class Parameter 窗口左侧的窗格中,单击 端口
  4. Default Behavior 区域中,选中 Override 复选框。
  5. Key Type 列表,选择 整数
  6. Default Value 字段中,输入 9090
  7. Smart Class Parameter 窗口左侧的窗格中,单击 server
  8. Default Behavior 区域中,选中 Override 复选框。
  9. Key Type 列表中,选择 字符串
  10. Default Value 字段中,输入负载均衡器的 FQDN,如 loadbalancer.example.com
  11. Smart Class Parameter 窗口的左下角,单击 Submit
  12. 使用 Puppet 继续部署合规策略。如需更多信息,请参阅:

验证

  • 在客户端上,验证 /etc/foreman_scap_client/config.yaml 文件包含以下行:

    # Foreman proxy to which reports should be uploaded
    :server: 'loadbalancer.example.com'
    :port: 9090
    Copy to Clipboard Toggle word wrap

法律通告

Copyright © 2024 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat