mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
50 lines
1.7 KiB
Plaintext
50 lines
1.7 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * nodes/nodes-containers-using.adoc
|
|
|
|
[id="nodes-containers-using-ssh_{context}"]
|
|
= Opening a Remote Shell to Containers
|
|
|
|
The `oc rsh` command allows you to locally access and manage tools that are on
|
|
the system. The secure shell (SSH) is the underlying technology and industry
|
|
standard that provides a secure connection to the application. Access to
|
|
applications with the shell environment is protected and restricted with
|
|
Security-Enhanced Linux (SELinux) policies.
|
|
|
|
While in the remote shell, you can issue commands as if you are inside the
|
|
container and perform local operations like monitoring, debugging, and using CLI
|
|
commands specific to what is running in the container.
|
|
|
|
For example, in a MySQL container, you can count the number of records in the
|
|
database by invoking the `mysql` command, then using the prompt to type in the `SELECT` command. You can
|
|
also use commands like `ps(1)` and `ls(1)` for validation.
|
|
|
|
`BuildConfigs` and `DeployConfigs` map out how you want things to look and
|
|
pods (with containers inside) are created and dismantled as needed. Your changes
|
|
are not persistent. If you make changes directly within the container and that
|
|
container is destroyed and rebuilt, your changes will no longer exist.
|
|
|
|
[NOTE]
|
|
====
|
|
You can use the `oc exec` c to execute a command remotely. However, the `oc rsh` command provides an easier way
|
|
to keep a remote shell open persistently.
|
|
====
|
|
|
|
.Procedure
|
|
|
|
. Open a console on a system networked to connect to the node where your pod is located.
|
|
|
|
. Open a remote shell session to a container:
|
|
+
|
|
----
|
|
$ oc rsh <pod>
|
|
----
|
|
|
|
[NOTE]
|
|
====
|
|
For help with usage, options, and to see examples:
|
|
----
|
|
$ oc rsh -h
|
|
----
|
|
====
|