1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/starting-debug-pods-with-root-access.adoc
2025-02-10 21:35:52 +00:00

58 lines
1.9 KiB
Plaintext

// Module included in the following assemblies:
//
// * support/troubleshooting/investigating-pod-issues.adoc
:_mod-docs-content-type: PROCEDURE
[id="starting-debug-pods-with-root-access_{context}"]
= Starting debug pods with root access
You can start a debug pod with root access, based on a problematic pod's deployment or deployment configuration. Pod users typically run with non-root privileges, but running troubleshooting pods with temporary root privileges can be useful during issue investigation.
.Prerequisites
ifndef::openshift-rosa,openshift-rosa-hcp,openshift-dedicated[]
* You have access to the cluster as a user with the `cluster-admin` role.
endif::openshift-rosa,openshift-rosa-hcp,openshift-dedicated[]
ifdef::openshift-rosa,openshift-rosa-hcp,openshift-dedicated[]
* You have access to the cluster as a user with the `dedicated-admin` role.
endif::openshift-rosa,openshift-rosa-hcp,openshift-dedicated[]
* Your API service is still functional.
* You have installed the OpenShift CLI (`oc`).
.Procedure
. Start a debug pod with root access, based on a deployment.
.. Obtain a project's deployment name:
+
[source,terminal]
----
$ oc get deployment -n <project_name>
----
.. Start a debug pod with root privileges, based on the deployment:
+
[source,terminal]
----
$ oc debug deployment/my-deployment --as-root -n <project_name>
----
. Start a debug pod with root access, based on a deployment configuration.
.. Obtain a project's deployment configuration name:
+
[source,terminal]
----
$ oc get deploymentconfigs -n <project_name>
----
.. Start a debug pod with root privileges, based on the deployment configuration:
+
[source,terminal]
----
$ oc debug deploymentconfig/my-deployment-configuration --as-root -n <project_name>
----
[NOTE]
====
You can append `-- <command>` to the preceding `oc debug` commands to run individual commands within a debug pod, instead of running an interactive shell.
====