Skip to content

Commit 9a0b96d

Browse files
DOCSP-40332 -- backport to v1.26 (#1820)
* DOCSP-40332 -- backport to v1.26 * DOCSP-40332 backport to v1.26 * DOCSP-40332 backport to v1.26 * DOCSP-40332 backport to v1.26
1 parent 9861c70 commit 9a0b96d

File tree

6 files changed

+158
-37
lines changed

6 files changed

+158
-37
lines changed

snooty.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ k8s-mdbrsc = "``MongoDB`` resource"
131131
kubectl = "`kubectl <https://kubernetes.io/docs/reference/kubectl/kubectl/>`__"
132132
kubectl-install = "`Install kubectl <https://kubernetes.io/docs/tasks/tools/#kubectl>`__"
133133
kustomize = "`Kustomize <https://kustomize.io/>`__"
134+
max-concurrent-reconciles = "`MaxConcurrentReconciles <https://pkg.go.dev/github.com/kubernetes-sigs/controller-runtime/pkg/controller#Options>`__"
134135
kustomize-install = "`Install Kustomize <https://kubectl.docs.kubernetes.io/installation/kustomize/>`__"
135136
minio = "`MinIO Operator <https://github.com/minio/operator>`__"
136137
mongodb-multi = "``MongoDBMultiCluster`` resource"

source/faq.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,9 @@ To learn more, see :ref:`MongoDB Kubernetes Operator Compatibility <k8s-compatib
9999
How many deployments can |k8s-op-full| support?
100100
--------------------------------------------------------------
101101

102-
|k8s-op-short| can support up to 50 deployments. However, changes made to
103-
large numbers of deployments at the same time result in long reconciliation times.
104-
To avoid prolonged reconciliation times, limit a given |k8s-op-short| instance
105-
to 20 deployments. To learn more, see the :ref:`Deploy the Recommended Number of MongoDB Replica Sets <deploy_recommended-number-sets>`.
102+
|k8s-op-short| can support hundreds of deployments.
103+
To facilitate parallel reconciliation operations and avoid prolonged
104+
reconciliation times, :ref:`increase thread count of your Kubernetes Operator instance <increase-thread-count-ops-manager>`.
106105

107106
Should I run MongoDB Server in |k8s| in the same cluster as the application using it?
108107
----------------------------------------------------------------------------------------------
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The number of concurrent reconciliation processes the |k8s-op-short| can perform.

source/reference/helm-operator-settings.txt

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,27 @@ The default value is **mongodb-enterprise-operator**.
331331
operator:
332332
name: mongodb-enterprise-operator
333333

334+
.. _mdb-max-concurrent-reconciles-helm:
335+
336+
operator.maxConcurrentReconciles
337+
--------------------------------
338+
339+
The maximum number of concurrent reconciliatios the |k8s-op-short| can perform.
340+
It sets |max-concurrent-reconciles|.
341+
To learn more, see the |k8s-op-short|
342+
:ref:`Deploy Multiple MongoDB Replica Sets. <deploy_recommended-number-sets>`
343+
344+
345+
.. example::
346+
347+
.. code-block:: yaml
348+
349+
operator:
350+
# Control how many reconciles can be performed in parallel.
351+
# Increasing the number of concurrent reconciliations decreases the time needed to reconcile all watched resources,
352+
# but it might result in request load spikes and increased load on the Ops Manager API, and the Kubernetes API server generally.
353+
maxConcurrentReconciles: 10
354+
334355
.. _helm-vault-secret-enabled:
335356

336357
operator.vaultSecretBackend.enabled
@@ -591,6 +612,43 @@ registry.opsManager
591612
registry:
592613
opsManager: registry.connect.redhat.com/mongodb
593614

615+
.. _k8s-op-resources-setting:
616+
617+
operator.resources.requests
618+
---------------------------
619+
620+
Specifications for the `CPU and memory consumption limits
621+
<https://kubernetes.io/docs/concepts/configuration/manage-resources-
622+
containers/#requests-and-limits>`__ of the |k8s-op-short|.
623+
624+
625+
.. example::
626+
627+
.. code-block:: yaml
628+
629+
# operator cpu requests and limits
630+
resources:
631+
requests:
632+
cpu: 500m
633+
memory: 200Mi
634+
635+
operator.resources.limits
636+
---------------------------
637+
638+
Specifications for the `CPU and memory consumption limits
639+
<https://kubernetes.io/docs/concepts/configuration/manage-resources-
640+
containers/#requests-and-limits>`__ of the |k8s-op-short|.
641+
642+
.. example::
643+
644+
.. code-block:: yaml
645+
646+
# operator cpu requests and limits
647+
resources:
648+
limits:
649+
cpu: 1100m
650+
memory: 1Gi
651+
594652
subresourceEnabled
595653
------------------
596654

source/reference/kubectl-operator-settings.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,27 @@ OPERATOR_ENV
534534
- name: OPERATOR_ENV
535535
value: prod
536536

537+
.. _mdb-max-concurrent-reconciles:
538+
539+
MDB_MAX_CONCURRENT_RECONCILES
540+
------------------------------
541+
542+
.. include:: /includes/op-setting-descs/mdb-max-concurrent-reconciles.rst
543+
544+
.. example::
545+
546+
.. code-block:: yaml
547+
:linenos:
548+
549+
spec:
550+
template:
551+
spec:
552+
serviceAccountName: mongodb-enterprise-operator
553+
containers:
554+
- env:
555+
- name: MDB_MAX_CONCURRENT_RECONCILES
556+
value: "10"
557+
537558
OPS_MANAGER_IMAGE_PULL_POLICY
538559
-----------------------------
539560

source/tutorial/plan-k8s-op-considerations.txt

Lines changed: 74 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,14 @@ recommendations for the |k8s-op-full| when running in production.
1717

1818
.. _deploy_recommended-number-sets:
1919

20-
Deploy the Recommended Number of MongoDB Replica Sets
21-
-----------------------------------------------------
20+
Deploy Multiple MongoDB Replica Sets
21+
------------------------------------
2222

2323
We recommend that you use a single instance of the |k8s-op-short|
24-
to deploy up to 20 replica sets in parallel.
24+
to deploy and manage your MongoDB replica sets.
2525

26-
You **may** increase this number to 50 and expect a reasonable
27-
increase in the time that the |k8s-op-short| takes to download,
28-
install, deploy, and reconcile its resources.
29-
30-
For 50 replica sets, the time to deploy varies and might take up to
31-
40 minutes. This time depends on the network bandwidth of the |k8s|
32-
cluster and the time it takes each {+mdbagent+} to download MongoDB
33-
installation binaries from the Internet for each MongoDB cluster member.
34-
35-
To deploy more than 50 MongoDB replica sets in parallel,
36-
use multiple instances of the |k8s-op-short|.
26+
To deploy more than 10 MongoDB replica sets in parallel,
27+
you can :ref:`increase the thread count of your Kubernetes Operator instance <increase-thread-count-ops-manager>`.
3728

3829
Specify CPU and Memory Resource Requirements
3930
--------------------------------------------
@@ -336,12 +327,20 @@ sharded clusters and standalone deployments.
336327
.. _operator_pod_resources:
337328

338329
Set CPU and Memory Utilization Bounds for the |k8s-op-short| Pod
339-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
330+
----------------------------------------------------------------
331+
332+
When you deploy MongoDB replica sets with the |k8s-op-short|, the initial
333+
reconcilliation process increases CPU usage for the Pod running the
334+
|k8s-op-short|. However, when the replica set deployment process completes,
335+
the CPU usage by the |k8s-op-short| reduces considerably.
336+
337+
.. note::
340338

341-
When you deploy replica sets with the |k8s-op-short|, CPU usage for
342-
Pod used to host the |k8s-op-short| is initially high during the
343-
reconciliation process, however, by the time the deployment completes,
344-
it lowers.
339+
The severity of CPU usage spikes in the |k8s-op-short| is directly impacted
340+
by :ref:`the thread count <increase-thread-count-ops-manager>` of the
341+
|k8s-op-short|, as the thread count (defined by the :ref:`MDB_MAX_CONCURRENT_RECONCILES <mdb-max-concurrent-reconciles>` value)
342+
is equal to the number of reconcilliation processes that can be running in
343+
parallel at any given time.
345344

346345
For production deployments, to satisfy deploying up to 50 MongoDB
347346
replica sets or sharded clusters in parallel with the |k8s-op-short|,
@@ -353,22 +352,16 @@ as follows:
353352
- ``spec.template.spec.containers.resources.requests.memory`` to 200Mi
354353
- ``spec.template.spec.containers.resources.limits.memory`` to 1Gi
355354

356-
If you don't include the unit of measurement for CPUs, |k8s| interprets
357-
it as the number of cores. If you specify ``m``, such as 500m, |k8s|
358-
interprets it as ``millis``. To learn more, see
359-
:k8sdocs:`Meaning of CPU </concepts/configuration/manage-resources-containers/#meaning-of-cpu>`.
355+
356+
If you use Helm to deploy resources, define these values in
357+
the :ref:`values.yaml file <k8s-op-resources-setting>`.
360358

361359
The following abbreviated example shows the configuration with
362360
recommended CPU and memory bounds for the |k8s-op-short| Pod in your
363361
deployment of 50 replica sets or sharded clusters. If you are
364362
deploying fewer than 50 MongoDB clusters, you may use lower
365363
numbers in the configuration file for the |k8s-op-short| Pod.
366364

367-
.. note::
368-
369-
Monitoring tools report the size of the |k8s-node| rather than the
370-
actual size of the container.
371-
372365
.. example::
373366

374367
.. code-block:: yaml
@@ -431,7 +424,7 @@ file.
431424
.. _mdb_pods_resources:
432425

433426
Set CPU and Memory Utilization Bounds for MongoDB Pods
434-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
427+
-------------------------------------------------------
435428

436429
The values for Pods hosting replica sets or sharded clusters map
437430
to the :k8sdocs:`requests field </reference/generated/kubernetes-api/{+k8s-api-version+}/#resourcerequirements-v1-core>`
@@ -450,10 +443,8 @@ for the MongoDB Pod as follows:
450443
- ``spec.podSpec.podTemplate.spec.containers.resources.requests.memory`` to 512M
451444
- ``spec.podSpec.podTemplate.spec.containers.resources.limits.memory`` to 512M
452445

453-
If you don't include the unit of measurement for CPUs, |k8s| interprets
454-
it as the number of cores. If you specify ``m``, such as 500m, |k8s|
455-
interprets it as ``millis``. To learn more, see
456-
:k8sdocs:`Meaning of CPU </concepts/configuration/manage-resources-containers/#meaning-of-cpu>`.
446+
If you use Helm to deploy resources, define these values in
447+
the :ref:`values.yaml file <k8s-op-resources-setting>`.
457448

458449
The following abbreviated example shows the configuration with
459450
recommended CPU and memory bounds for each Pod hosting a MongoDB
@@ -567,3 +558,53 @@ configurations for sharded clusters and standalone MongoDB deployments.
567558

568559
- :k8sdocs:`Running in Multiple Zones </setup/best-practices/multiple-zones/>`
569560
- :k8sdocs:`Node affinity </concepts/scheduling-eviction/assign-pod-node/#node-affinity>`
561+
562+
.. _increase-thread-count-ops-manager:
563+
564+
Increase Thread Count to Run multiple Reconciliation Processes in Parallel
565+
--------------------------------------------------------------------------
566+
567+
If you plan to deploy more than 10 MongoDB replica sets in parallel,
568+
you can configure the |k8s-op-short| to run multiple reconciliation processes
569+
in parallel by setting :ref:`MDB_MAX_CONCURRENT_RECONCILES <mdb-max-concurrent-reconciles>` environment variable in your |k8s-op-short|
570+
deployment or or through the :ref:`operator.maxConcurrentReconciles <mdb-max-concurrent-reconciles-helm>` field in your Helm
571+
``values.yaml`` file to configure a higher thread count.
572+
573+
Increasing the thread count of the |k8s-op-short| allows you to vertically scale your |k8s-op-short|
574+
deployment to hundreds of |k8s-mdbrscs| running within your |k8s| cluster
575+
and optimize CPU utilization.
576+
577+
Please monitor |k8s| API server and |k8s-op-short| resource usage and adjust their respective
578+
resource allocation if necessary.
579+
580+
.. note::
581+
582+
- Proceed with caution when increasing the :ref:`MDB_MAX_CONCURRENT_RECONCILES <mdb-max-concurrent-reconciles>` beyond 10.
583+
In particular, you must monitor the |k8s-op-short|, and the |k8s| API
584+
closely to avoid downtime resulting from increased load on those components.
585+
586+
To determine the thread count that suits your deployment's needs,
587+
use the following guidelines:
588+
589+
- Your requirements for how responsive the |k8s-op-short| must be when
590+
reconciling many resources
591+
592+
- The compute resources available within your |k8s| environment and
593+
the total processing load your |k8s| compute resources are under, including
594+
resources that may be unrelated to MongoDB
595+
596+
- An alternative to increasing the thread count of a single |k8s-op-short|
597+
instance, while still increasing the number of |k8s-mdbrscs| you can support
598+
in your |k8s| cluster, is to deploy multiple |k8s-op-short| instances within
599+
your |k8s| cluster. However, deploying multiple |k8s-op-short|
600+
instances requires that you ensure that no two |k8s-op-short| instances
601+
are monitoring the same |k8s-mdbrscs|.
602+
603+
Running more than one instance of the |k8s-op-short| should be done with care,
604+
as more |k8s-op-short| instances (especially with parallel reconciliation enabled)
605+
put the API server at greater risk of being overwhelmed.
606+
607+
- Scaling of the |k8s| API server is not a valid reason to run
608+
more than one instance of the |k8s-op-short|. If you observe that performance of
609+
the API server is affected, adding more instances of the |k8s-op-short| is
610+
likely to compound the problem.

0 commit comments

Comments
 (0)