Skip to content

Commit 8137616

Browse files
committed
mgr/cephadm: Add virtual_ip as a param for mgmt-gateway apply cmd
Signed-off-by: Redouane Kachach <[email protected]>
1 parent 3008ab4 commit 8137616

File tree

3 files changed

+41
-30
lines changed

3 files changed

+41
-30
lines changed

doc/cephadm/services/mgmt-gateway.rst

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ Management Gateway
77
Deploying mgmt-gateway
88
======================
99

10-
In Ceph releases beginning with Squid, the `mgmt-gateway` service introduces a new design for Ceph applications
10+
In Ceph releases beginning with Squid, the ``mgmt-gateway`` service introduces a new design for Ceph applications
1111
based on a modular, service-based architecture. This service, managed by cephadm and built on top of nginx
1212
(an open-source, high-performance web server), acts as the new front-end and single entry point to the
13-
Ceph cluster. The `mgmt-gateway` provides unified access to all Ceph applications, including the Ceph dashboard
13+
Ceph cluster. The ``mgmt-gateway`` provides unified access to all Ceph applications, including the Ceph dashboard
1414
and monitoring stack. Employing nginx enhances security and simplifies access management due to its robust
15-
community support and high-security standards. The `mgmt-gateway` service acts as a reverse proxy that routes
15+
community support and high-security standards. The ``mgmt-gateway`` service acts as a reverse proxy that routes
1616
requests to the appropriate Ceph application instances.
1717

18-
In order to deploy the mgmt-gateway service, use the following command:
18+
In order to deploy the ``mgmt-gateway`` service, use the following command:
1919

2020
.. prompt:: bash #
2121

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

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

2828

2929
Benefits of the mgmt-gateway service
@@ -36,40 +36,45 @@ Benefits of the mgmt-gateway service
3636
Security enhancements
3737
=====================
3838

39-
Once the `mgmt-gateway` service is deployed user cannot access monitoring services without authentication through the
39+
Once the ``mgmt-gateway`` service is deployed user cannot access monitoring services without authentication through the
4040
Ceph dashboard.
4141

4242

4343
High availability enhancements
4444
==============================
4545
nginx HA mechanisms are used to provide high availability for all the Ceph management applications including the Ceph dashboard
4646
and monitoring stack. In case of the Ceph dashboard user no longer need to know where the active manager is running.
47-
`mgmt-gateway` handles manager failover transparently and redirects the user to the active manager. In case of the
48-
monitoring `mgmt-gateway` takes care of handling HA when several instances of Prometheus, Alertmanager or Grafana are
47+
``mgmt-gateway`` handles manager failover transparently and redirects the user to the active manager. In case of the
48+
monitoring ``mgmt-gateway`` takes care of handling HA when several instances of Prometheus, Alertmanager or Grafana are
4949
available. The reverse proxy will automatically detect healthy instances and use them to process user requests.
5050

5151

5252
High Availability for mgmt-gateway service
5353
==========================================
5454

55-
In addition to providing high availability for the underlying backend services, the mgmt-gateway
55+
In addition to providing high availability for the underlying backend services, the ``mgmt-gateway``
5656
service itself can be configured for high availability, ensuring that the system remains resilient
57-
even if certain core components for the service fail.
57+
even if certain core components for the service fail, including the ``mgmt-gateway`` itself.
5858

59-
Multiple mgmt-gateway instances can be deployed in an active/standby configuration using keepalived
60-
for seamless failover. The `oauth2-proxy` service can be deployed as multiple stateless instances,
59+
Multiple ``mgmt-gateway`` instances can be deployed in an active/standby configuration using keepalived
60+
for seamless failover. The ``oauth2-proxy`` service can be deployed as multiple stateless instances,
6161
with nginx acting as a load balancer across them using round-robin strategy. This setup removes
6262
single points of failure and enhances the resilience of the entire system.
6363

6464
In this setup, the underlying internal services follow the same high availability mechanism. Instead of
65-
directly accessing the `mgmt-gateway` internal endpoint, services use the virtual IP specified in the spec.
66-
This ensures that the high availability mechanism for `mgmt-gateway` is transparent to other services.
65+
directly accessing the ``mgmt-gateway`` internal endpoint, services use the virtual IP specified in the spec.
66+
This ensures that the high availability mechanism for ``mgmt-gateway`` is transparent to other services.
6767

68-
Example Configuration for High Availability
68+
The simplest and recommended way to deploy the ``mgmt-gateway`` in high availability mode is by using labels. To
69+
run the ``mgmt-gateway`` in HA mode users can either use the cephadm command line as follows:
6970

70-
To deploy the mgmt-gateway in a high availability setup, here is an example of the specification files required:
71+
.. prompt:: bash #
72+
73+
ceph orch apply mgmt-gateway --virtual_ip 192.168.100.220 --enable-auth=true --placement="label:mgmt"
7174

72-
`mgmt-gateway` Configuration:
75+
Or provide specification files as following:
76+
77+
``mgmt-gateway`` Configuration:
7378

7479
.. code-block:: yaml
7580
@@ -80,7 +85,8 @@ To deploy the mgmt-gateway in a high availability setup, here is an example of t
8085
enable_auth: true
8186
virtual_ip: 192.168.100.220
8287
83-
`Ingress` Configuration for Keepalived:
88+
In addition, the user must configure an ingress service to provide virtual IP functionality for
89+
the ``mgmt-gateway``. For example:
8490

8591
.. code-block:: yaml
8692
@@ -92,24 +98,26 @@ To deploy the mgmt-gateway in a high availability setup, here is an example of t
9298
backend_service: mgmt-gateway
9399
keepalive_only: true
94100
95-
The number of deployed instances is determined by the number of hosts with the mgmt label.
96-
The ingress is configured in `keepalive_only` mode, with labels ensuring that any changes to
97-
the mgmt-gateway daemons are replicated to the corresponding keepalived instances. Additionally,
98-
the `virtual_ip` parameter must be identical in both specifications.
101+
The number of deployed instances is determined by the number of hosts with the ``mgmt`` label.
102+
The ingress is configured in ``keepalive_only`` mode, with labels ensuring that any changes to
103+
the ``mgmt-gateway`` daemons are replicated to the corresponding keepalived instances.
104+
105+
.. note::
99106

107+
The ``virtual_ip`` parameter must be identical in both the ingress and ``mgmt-gateway`` specifications.
100108

101109
Accessing services with mgmt-gateway
102110
====================================
103111

104-
Once the `mgmt-gateway` service is deployed direct access to the monitoring services will not be allowed anymore.
112+
Once the ``mgmt-gateway`` service is deployed direct access to the monitoring services will not be allowed anymore.
105113
Applications including: Prometheus, Grafana and Alertmanager are now accessible through links
106-
from `Administration > Services`.
114+
from ``Administration > Services``.
107115

108116

109117
Service Specification
110118
=====================
111119

112-
A mgmt-gateway service can be applied using a specification. An example in YAML follows:
120+
A ``mgmt-gateway`` service can be applied using a specification. An example in YAML follows:
113121

114122
.. code-block:: yaml
115123
@@ -141,7 +149,7 @@ A mgmt-gateway service can be applied using a specification. An example in YAML
141149
[...]
142150
-----END PRIVATE KEY-----
143151
144-
Fields specific to the ``spec`` section of the mgmt-gateway service are described below.
152+
Fields specific to the ``spec`` section of the ``mgmt-gateway`` service are described below.
145153

146154
.. py:currentmodule:: ceph.deployment.service_spec
147155
@@ -179,18 +187,18 @@ Limitations
179187
Default images
180188
~~~~~~~~~~~~~~
181189

182-
The `mgmt-gateway` service internally makes use of nginx reverse proxy. The following container image is used by default:
190+
The ``mgmt-gateway`` service internally makes use of nginx reverse proxy. The following container image is used by default:
183191

184192
::
185193

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

188-
Admins can specify the image to be used by changing the `container_image_nginx` cephadm module option. If there were already
196+
Admins can specify the image to be used by changing the ``container_image_nginx`` cephadm module option. If there were already
189197
running daemon(s) you must redeploy the daemon(s) in order to have them actually use the new image.
190198

191199
For example:
192200

193201
.. code-block:: bash
194202
195203
ceph config set mgr mgr/cephadm/container_image_nginx <new-nginx-image>
196-
ceph orch redeploy mgmt-gateway
204+
ceph orch redeploy ``mgmt-gateway``

src/pybind/mgr/orchestrator/module.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,6 +1898,7 @@ def _apply_mgmt_gateway(self,
18981898
port: Optional[int] = None,
18991899
disable_https: Optional[bool] = False,
19001900
enable_auth: Optional[bool] = False,
1901+
virtual_ip: Optional[str] = None,
19011902
placement: Optional[str] = None,
19021903
unmanaged: bool = False,
19031904
dry_run: bool = False,
@@ -1912,6 +1913,7 @@ def _apply_mgmt_gateway(self,
19121913
placement=PlacementSpec.from_string(placement),
19131914
unmanaged=unmanaged,
19141915
port=port,
1916+
virtual_ip=virtual_ip,
19151917
disable_https=disable_https,
19161918
enable_auth=enable_auth,
19171919
preview_only=dry_run

src/python-common/ceph/deployment/service_spec.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1894,8 +1894,9 @@ def __init__(self,
18941894
self.ssl_protocols = ssl_protocols
18951895
#: List of supported secure SSL ciphers. Changing this list may reduce system security.
18961896
self.ssl_ciphers = ssl_ciphers
1897-
self.enable_health_check_endpoint = enable_health_check_endpoint
1897+
#: Virtual IP address used for the management gateway in a high availability setup.
18981898
self.virtual_ip = virtual_ip
1899+
self.enable_health_check_endpoint = enable_health_check_endpoint
18991900

19001901
def get_port_start(self) -> List[int]:
19011902
ports = []

0 commit comments

Comments
 (0)