@@ -220,7 +220,7 @@ To view all |k8s-mdbrsc| specifications in the provided
220
220
metadata:
221
221
annotations:
222
222
kubectl.kubernetes.io/last-applied-configuration: |
223
- {"apiVersion":"mongodb.com/v1","kind":"MongoDB","metadata":{"annotations":{},"name":"dublin","namespace":"mongodb"},"spec":{"credentials":"alis- credentials","persistent":false,"podSpec":{"memory":"1G"},"project":"my-om-config","type":"Standalone","version":"4.0.0-ent"}}
223
+ {"apiVersion":"mongodb.com/v1","kind":"MongoDB","metadata":{"annotations":{},"name":"dublin","namespace":"mongodb"},"spec":{"credentials":"credentials","persistent":false,"podSpec":{"memory":"1G"},"project":"my-om-config","type":"Standalone","version":"4.0.0-ent"}}
224
224
clusterDomain: ""
225
225
creationTimestamp: 2018-09-12T17:15:32Z
226
226
generation: 1
@@ -526,6 +526,81 @@ policy through the :opsmgr:`API
526
526
}'
527
527
528
528
The features are now blocked again, preventing you from making
529
- furher changes through the |onprem| application. However, the
529
+ further changes through the |onprem| application. However, the
530
530
|k8s-op-short| retains any changes you made in the |onprem|
531
531
application while features were available.
532
+
533
+ Tune MongoDB |k8s| Resource Docker Images
534
+ -----------------------------------------
535
+
536
+ |k8s-mdbrsc| Docker images run on Ubuntu and use Ubuntu's default
537
+ system configuration. Using the :setting:`spec.podSpec.podTemplate`
538
+ setting, add a privileged sidecar :k8sdocs:`init container
539
+ </concepts/workloads/pods/init-containers/>` to the |k8s-mdbrsc|
540
+ definition to tune the underlying Ubuntu system configuration in the
541
+ |k8s-mdbrsc| containers.
542
+
543
+ .. example::
544
+
545
+ |k8s-mdbrsc| Docker images use the Ubuntu default ``keepalive`` time
546
+ of ``7200``. MongoDB recommends a shorter ``keepalive`` time of ``120``
547
+ for database deployments.
548
+
549
+ You can tune the ``keepalive`` time in the |k8s-mdbrscs| Docker images
550
+ if you experience network timeouts or socket errors in communication
551
+ between clients and |k8s-mdbrscs|.
552
+
553
+ To tune |k8s-mdbrsc| Docker images:
554
+
555
+ 1. Update the |k8s-mdbrsc| definition to append a privileged sidecar
556
+ container to |k8s-mdbrsc| pods the |k8s-op-short| creates.
557
+
558
+ The following sample :setting:`spec.podSpec.podTemplate` changes the
559
+ ``keepalive`` value to the recommended value of ``120``:
560
+
561
+ .. code-block:: yaml
562
+
563
+ spec:
564
+ podSpec:
565
+ podTemplate:
566
+ spec:
567
+ initContainers:
568
+ - name: "apply-sysctl-test"
569
+ image: "busybox:latest"
570
+ securityContext:
571
+ privileged: true
572
+ command: ["sysctl", "-w", "net.ipv4.tcp_keepalive_time=120"]
573
+
574
+ #. Apply the updated resource definition:
575
+
576
+ .. code-block:: none
577
+
578
+ kubectl apply -f <database-resource-conf>.yaml -n <namespace>
579
+
580
+ A privileged sidecar container is added to each |k8s-pod| the
581
+ |k8s-op-short| created using the |k8s-mdbrsc| definition.
582
+
583
+ To verify your changes:
584
+
585
+ 1. Get a shell to a running container in your database resource
586
+ |k8s-pod|:
587
+
588
+ .. code-block:: none
589
+
590
+ kubectl exec -n <namespace> -it <pod-name> -- /bin/bash
591
+
592
+ #. Verify your changes are present. Following the example, verify that
593
+ the ``keepalive`` time is changed:
594
+
595
+ .. code-block:: none
596
+
597
+ cat /proc/sys/net/ipv4/tcp_keepalive_time
598
+
599
+ Returns:
600
+
601
+ .. code-block:: none
602
+ :copyable: false
603
+
604
+ 120
605
+
606
+ .. seealso:: :manual:`Operating System Configuration </administration/production-checklist-operations/#linux>` in the MongoDB Manual.
0 commit comments