OC(1)
π oc rsh β NAME
okay so bestie, this is oc rsh from oc(1), dated June 2016 β and it's the "start a shell session in a container" girlie. That's the whole vibe. You wanna get inside a container and poke around? This is the command. π
β¨ SYNOPSIS β¨
oc rsh [OPTIONS]
π«Ά DESCRIPTION π«Ά
So here's the tea: oc rsh opens a remote shell session to a container. Literally, you get a shell inside the container, no cap. π₯
This command will attempt to start a shell session in a pod for the resource you specify. It works with pods, deployment configs, deployments, jobs, daemon sets, replication controllers and replica sets. Any of those resources (apart from pods β pods are already pods, they don't need resolving, main character energy) will be resolved to a ready pod.
It'll default to the first container if you don't specify one, and it will attempt to use '/bin/sh' as the default shell. π
You may pass any flags supported by this command before the resource name, and an optional command after the resource name, which will be executed instead of a login shell. A TTY will be automatically allocated if standard input is interactive β use -t and -T to override that. A TERM variable is sent to the environment where the shell (or command) will be executed. By default its value is the same as the TERM variable from your local environment; if it's not set, 'xterm' is used. π
Heads up bestie π β some containers may not include a shell. If that's your situation, use 'oc exec' when you need to run commands directly. Not every container is gonna serve looks.
π OPTIONS π
-c,--container=""β container name; defaults to the first container. simple as that, she picks for you π-f,--filename=[]β to use to rsh into the resource (yes, that's literally how it's worded, I'm just the messenger π)-T,--no-tty=falseβ disable pseudo-terminal allocation. no fake tty for you β¨--pod-running-timeout=0β the length of time (like5s,2m, or3h, higher than zero) to wait until at least one pod is running. patience is a virtue, but she's got a limit β³--shell="/bin/sh"β path to the shell command π-t,--tty=falseβ force a pseudo-terminal to be allocated. give her the tty, she deserves it π
π OPTIONS INHERITED FROM PARENT COMMANDS π
these are the family heirlooms, bestie β inherited, still iconic:
--as=""β username to impersonate for the operation. user could be a regular user or a service account in a namespace. dress up as someone else, we love a transformation arc π¦--as-group=[]β group to impersonate for the operation; this flag can be repeated to specify multiple groups.--as-uid=""β UID to impersonate for the operation.--as-user-extra=[]β user extras to impersonate for the operation; this flag can be repeated to specify multiple values for the same key.--cache-dir="/homeless-shelter/.kube/cache"β default cache directory.--certificate-authority=""β path to a cert file for the certificate authority.--client-certificate=""β path to a client certificate file for TLS.--client-key=""β path to a client key file for TLS.--cluster=""β the name of the kubeconfig cluster to use.--context=""β the name of the kubeconfig context to use.--disable-compression=falseβ if true, opt out of response compression for all requests to the server.--insecure-skip-tls-verify=falseβ if true, the server's certificate will not be checked for validity. this will make your HTTPS connections insecure. β οΈ like, genuinely insecure, not cute-insecure. be careful babes.--kubeconfig=""β path to the kubeconfig file to use for CLI requests.--kuberc=""β path to the kuberc file to use for preferences. this can be disabled by exportingKUBECTL_KUBERC=falsefeature gate or turning off the featureKUBERC=off. iykyk π§--match-server-version=falseβ require server version to match client version. she's picky, and honestly? valid.-n,--namespace=""β if present, the namespace scope for this CLI request.--profile="none"β name of profile to capture. one of(none|cpu|heap|goroutine|threadcreate|block|mutex).--profile-output="profile.pprof"β name of the file to write the profile to.--request-timeout="0"β the length of time to wait before giving up on a single server request. non-zero values should contain a corresponding time unit (e.g.1s,2m,3h). a value of zero means don't timeout requests. she'll wait forever, that's her toxic trait π-s,--server=""β the address and port of the Kubernetes API server.--tls-server-name=""β server name to use for server certificate validation. if it is not provided, the hostname used to contact the server is used.--token=""β bearer token for authentication to the API server.--user=""β the name of the kubeconfig user to use.--warnings-as-errors=falseβ treat warnings received from the server as errors and exit with a non-zero exit code. no warnings, only consequences π
πΈ EXAMPLE πΈ
okay these are the ~lewks~, copied exactly, go off:
# Open a shell session on the first container in pod 'foo'
oc rsh foo
# Open a shell session on the first container in pod 'foo' and namespace 'bar'
# (Note that oc client specific arguments must come before the resource name and its arguments)
oc rsh -n bar foo
# Run the command 'cat /etc/resolv.conf' inside pod 'foo'
oc rsh foo cat /etc/resolv.conf
# See the configuration of your internal registry
oc rsh dc/docker-registry cat config.yml
# Open a shell session on the container named 'index' inside a pod of your job
oc rsh -c index job/scheduled
π¦ SEE ALSO π¦
(that trailing comma is hers, we respect it π)
π HISTORY π
- June 2016 β Ported from the Kubernetes man-doc generator. vintage! an icon was born β¨
okay bestie, that's the whole page π«Ά go forth and shell into things responsibly. this little number comes to you from Openshift, part of the Openshift CLI User Manuals, and it's dated all the way back to June 2016 β stan a timeless classic πππ¦
π¦ where this page comes from
- nixpkgs unstable: openshift 4.22.0-202605222050
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms