注意

本文档适用于 Ceph 开发版本。

管理网关

部署 mgmt-gateway

在以 Squid 开头的 Ceph 版本中,该服务引入了一种基于模块化、基于服务架构的 Ceph 应用新设计。由 cephadm 管理,并基于 nginx(一个开源、高性能的 Web 服务器)构建,作为 Ceph 集群的新前端和单一入口点。该服务提供对所有 Ceph 应用的统一访问,包括 Ceph 仪表板和监控堆栈。采用 nginx 可以增强安全性并简化访问管理,因为它具有强大的社区支持和高级别的安全标准。该服务充当反向代理,将请求路由到适当的 Ceph 应用实例。mgmt-gateway service introduces a new design for Ceph applications based on a modular, service-based architecture. This service, managed by cephadm and built on top of nginx (an open-source, high-performance web server), acts as the new front-end and single entry point to the Ceph cluster. The mgmt-gateway提供对所有 Ceph 应用的统一访问,包括 Ceph 仪表板和监控堆栈。采用 nginx 增强了安全性并简化了访问管理,由于其强大的社区支持和高级别的安全标准。该服务充当反向代理,将请求路由到适当的 Ceph 应用实例。mgmt-gateway该服务充当反向代理,将请求路由到适当的 Ceph 应用实例。

为了部署该服务,一旦应用了 cephadm,它将重新配置特定的运行守护进程(例如监控)以在新建的服务后面运行。这些服务的对外访问将不再可能。访问将被集中在新的服务端点:mgmt-gateway服务,请使用以下命令:

ceph orch apply mgmt-gateway [--placement ...] ...

Once applied cephadm will reconfigure specific running daemons (such as monitoring) to run behind the new created service. External access to those services will not be possible anymore. Access will be consolidated behind the new service endpoint: https://<node-ip>:<port>.

mgmt-gateway 服务的优势

  • Unified Access: 通过 nginx 集中访问提高了安全性,并为服务提供了一个单一入口点。

  • Improved user experience: 用户不再需要知道每个应用正在运行的位置(ip/主机)。

  • High Availability for dashboard: 使用 nginx 高可用性机制为 Ceph 仪表板提供高可用性。

  • High Availability for monitoring: 使用 nginx 高可用性机制为监控提供高可用性。

安全增强功能

一旦该服务部署完成,将不再允许直接访问监控服务。包括 Prometheus、Grafana 和 Alertmanager 在内的应用现在可以通过来自 mgmt-gateway 服务的链接访问。以下是服务链接的描述。mgmt-gateway service is deployed user cannot access monitoring services without authentication through the Ceph dashboard.

高可用性增强

使用 nginx 高可用性机制为所有 Ceph 管理应用提供高可用性,包括 Ceph 仪表板和监控堆栈。在 Ceph 仪表板的情况下,用户不再需要知道活动管理器正在运行的位置。mgmt-gateway处理管理器故障转移,并透明地将用户重定向到活动管理器。在监控的情况下,处理高可用性,当有多个 Prometheus、Alertmanager 或 Grafana 实例可用时。反向代理将自动检测健康的实例,并使用它们来处理用户请求。mgmt-gateway takes care of handling HA when several instances of Prometheus, Alertmanager or Grafana are available. The reverse proxy will automatically detect healthy instances and use them to process user requests.

mgmt-gateway 服务的高可用性

除了为底层后端服务提供高可用性外,该服务本身也可以配置为高可用性,确保即使服务的一些核心组件发生故障,系统仍然具有弹性,包括该服务本身。mgmt-gateway service itself can be configured for high availability, ensuring that the system remains resilient even if certain core components for the service fail, including the mgmt-gateway itself.

可以使用 keepalived 以活动/备用配置部署多个实例,以实现无缝故障转移。该服务可以部署为多个无状态实例,nginx 作为负载均衡器跨它们使用轮询策略。这种设置消除了单点故障,并增强了整个系统的弹性。mgmt-gateway instances can be deployed in an active/standby configuration using keepalived for seamless failover. The oauth2-proxy service can be deployed as multiple stateless instances, with nginx acting as a load balancer across them using round-robin strategy. This setup removes single points of failure and enhances the resilience of the entire system.

在这种设置中,底层内部服务遵循相同的高可用性机制。服务不直接访问内部端点,而是使用 spec 中指定的虚拟 IP。这确保了其他服务对 mgmt-gateway 的高可用性机制是透明的。mgmt-gateway internal endpoint, services use the virtual IP specified in the spec. This ensures that the high availability mechanism for mgmt-gateway is transparent to other services.

部署该服务在高可用性模式下的最简单和推荐的方法是使用标签。要在高可用性模式下运行该服务,用户可以使用 cephadm 命令行,如下所示:mgmt-gateway或提供规范文件,如下所示:mgmt-gateway配置:

ceph orch apply mgmt-gateway --virtual_ip 192.168.100.220 --enable-auth=true --placement="label:mgmt"

Or provide specification files as following:

mgmt-gateway Configuration:

service_type: mgmt-gateway
placement:
  label: mgmt
spec:
  enable_auth: true
  virtual_ip: 192.168.100.220

此外,用户必须配置一个 ingress 服务,以提供 mgmt-gateway 的虚拟 IP 功能。部署的实例数量由具有 d18c1d 标签的主机数量决定。ingress 在 40cc62 模式下配置,标签确保对任何 d5644fc 守护进程的更改都会复制到相应的 keepalived 实例。mgmt-gateway从仓库中删除它。例如:

service_type: ingress
service_id: ingress-mgmt-gw
placement:
  label: mgmt
virtual_ip: 192.168.100.220
backend_service: mgmt-gateway
keepalive_only: true

The number of deployed instances is determined by the number of hosts with the mgmt label. The ingress is configured in keepalive_only mode, with labels ensuring that any changes to the mgmt-gateway daemons are replicated to the corresponding keepalived instances.

Note

The virtual_ip参数在 ingress 和 637233 规范中必须相同。mgmt-gateway specifications.

使用 mgmt-gateway 访问服务

一旦该服务部署完成,将不再允许直接访问监控服务。包括 Prometheus、Grafana 和 Alertmanager 在内的应用现在可以通过来自 mgmt-gateway 服务的链接访问。以下是服务链接的描述。mgmt-gateway service is deployed direct access to the monitoring services will not be allowed anymore. Applications including: Prometheus, Grafana and Alertmanager are now accessible through links from Administration > Services.

服务规范

A mgmt-gateway服务可以使用规范应用。以下是一个YAML示例:

service_type: mgmt-gateway
service_id: gateway
placement:
  hosts:
    - ceph0
spec:
 port: 5000
 ssl: True
 ssl_protocols:
   - TLSv1.2
   - TLSv1.3
   - ...
 ssl_ciphers:
   - AES128-SHA
   - AES256-SHA
   - ...
 ssl_cert: |
   -----BEGIN CERTIFICATE-----
   MIIDtTCCAp2gAwIBAgIYMC4xNzc1NDQxNjEzMzc2MjMyXzxvQ7EcMA0GCSqGSIb3
   DQEBCwUAMG0xCzAJBgNVBAYTAlVTMQ0wCwYDVQQIDARVdGFoMRcwFQYDVQQHDA5T
   [...]
   -----END CERTIFICATE-----
 ssl_key: |
   -----BEGIN PRIVATE KEY-----
   MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC5jdYbjtNTAKW4
   /CwQr/7wOiLGzVxChn3mmCIF3DwbL/qvTFTX2d8bDf6LjGwLYloXHscRfxszX/4h
   [...]
   -----END PRIVATE KEY-----

特定于spec部分的mgmt-gateway service are described below.

class ceph.deployment.service_spec.MgmtGatewaySpec(service_type='mgmt-gateway', service_id=, config=, 网络=, placement=, ssl=True, enable_auth=False, port=, ssl_cert=, ssl_key=, ssl_prefer_server_ciphers=, ssl_session_tickets=, ssl_session_timeout=, ssl_session_cache=, server_tokens=, ssl_stapling=, ssl_stapling_verify=, ssl_protocols=, ssl_ciphers=, enable_health_check_endpoint=False, virtual_ip=, preview_only=False, unmanaged=False, extra_container_args=, extra_entrypoint_args=, custom_configs=)
enable_auth

启用 SSO 身份验证的标志。需要 oauth2-proxy 处于活动状态以进行 SSO 身份验证。

网络: 列表[字符串]

一个网络标识符列表,指示守护进程仅在列表中的特定网络上绑定。如果集群分布在多个网络上,您可以添加多个网络。请参阅网络和端口, 指定网络指定网络.

placement: PlacementSpec

请参阅守护进程放置.

port

服务器将监听哪个端口号

server_tokens

控制响应中服务器标记的标志:on | off | build | string

ssl

启用/禁用 HTTPS 的标志。默认设置为 True。

ssl_cert

包含 SSL 证书的多行字符串

ssl_ciphers

支持的 SSL 安全密码列表。更改此列表可能会降低系统安全性。

ssl_key

包含 SSL 密钥的多行字符串

ssl_prefer_server_ciphers

优先于客户端密码使用服务器密码:on | off

ssl_protocols

支持的 SSL 协议列表(nginx 支持的)

ssl_session_cache

SSL/TLS 会话缓存的持续时间:off | none | [builtin[:size]] [shared:name:size]

ssl_session_tickets

控制会话票据的多选项标志:on | off

ssl_session_timeout

SSL 会话超时的持续时间。语法:时间(例如:5m)

ssl_stapling

启用或禁用 SSL 拉链的标志:on | off

ssl_stapling_verify

控制 SSL 拉链验证的标志:on | off

virtual_ip

在高可用性设置中用于管理网关的虚拟 IP 地址。

警告

目前,TLSv1.3 被认为是安全的,并且默认包含一组安全的密码。在为旧版本配置 SSL/TLS 密码时,尤其是 TLSv1.2,必须仅使用安全密码的子集。使用弱密码或过时的密码可能会显著降低您的系统安全性。

任何对 SSL/TLS 配置密码列表的更改都是系统管理员的责任。在没有充分了解影响的情况下,请勿修改这些列表。不正确的配置可能导致弱加密、缺乏前向保密性和易受各种攻击等漏洞。配置 SSL/TLS 设置时,始终参考最新的安全指南和最佳实践。

运行服务器。然后可以通过运行以下命令应用规范:

ceph orch apply -i mgmt-gateway.yaml

限制

  • 服务必须根据要代理的应用绑定到适当的端口。确保没有端口冲突可能会中断服务可用性。

默认镜像

The mgmt-gateway服务内部使用 nginx 反向代理。默认使用的容器镜像如下:

mgr/cephadm/container_image_nginx = 'quay.io/ceph/nginx:sclorg-nginx-126'

管理员可以通过更改 cephadm 模块选项来指定要使用的镜像。如果已经运行了守护进程,则必须重新部署守护进程,以便它们实际上使用新的镜像。container_image_nginx cephadm module option. If there were already running daemon(s) you must redeploy the daemon(s) in order to have them actually use the new image.

例如:

ceph config set mgr mgr/cephadm/container_image_nginx <new-nginx-image>
ceph orch redeploy ``mgmt-gateway``

由 Ceph 基金会带给您

Ceph 文档是一个社区资源,由非盈利的 Ceph 基金会资助和托管Ceph Foundation. 如果您想支持这一点和我们的其他工作,请考虑加入现在加入.