@@ -567,3 +567,47 @@ policy through the :opsmgr:`API </reference/api/controlled-features/update-contr
567
567
further changes through the |onprem| application. However, the
568
568
|k8s-op-short| retains any changes you made in the |onprem|
569
569
application while features were available.
570
+
571
+ .. _k8s-debug-failed container:
572
+
573
+ Debugging a Failing Container
574
+ -----------------------------
575
+
576
+ A container might fail with an error that results in |k8s| restarting
577
+ that container in a loop.
578
+
579
+ You may need to interact with that container to inspect files or run
580
+ commands. This requires you to prevent the container from restarting.
581
+
582
+ 1. In your preferred text editor, open the MongoDB resource you need to
583
+ repair.
584
+
585
+ #. To this resource, add a ``podSpec`` collection that resembles the
586
+ following.
587
+
588
+ .. code-block:: yaml
589
+
590
+ podSpec:
591
+ podTemplate:
592
+ spec:
593
+ containers:
594
+ - name: mongodb-enterprise-database
595
+ command: ['sh', '-c', 'echo "Hello!" && sleep 3600' ]
596
+
597
+ The :wikipedia:`sleep </Sleep_(command)>` command in the
598
+ :setting:`spec.podSpec.podTemplate.spec` instructs the container to
599
+ wait for the number of seconds you specify. In this example, the
600
+ container will wait for 1 hour.
601
+
602
+ #. Apply this change to the resource.
603
+
604
+ .. code-block:: sh
605
+
606
+ kubectl apply -f <resource>.yaml
607
+
608
+ #. Invoke the shell inside the container.
609
+
610
+ .. code-block:: sh
611
+
612
+ kubectl exec -it <pod-name> bash
613
+
0 commit comments