OC(1)
π
OC(1) β oc attach, the attach-to-a-running-container manual π
okay so bestie, this is the OC(1) page for oc attach. She's short, she's useful, and she's about to make attaching to a running container make sense. π
π NAME π
oc attach β attach to a running container. That's the whole name, and she's iconic. β¨
β¨ SYNOPSIS β¨
oc attach [OPTIONS]
literally that's the shape of it: oc attach plus whatever [OPTIONS] you need. π«Ά
π DESCRIPTION π
okay so oc attach attaches you to a process that is already running inside an existing container. It's giving βjoin the group chat that's already popping offβ energy β you're attaching to the one that's already there. π
That's the description, bestie. Short, sweet, to the point. πΈ
πΈ OPTIONS πΈ
these are the flags that belong to oc attach itself. read them, love them, use them. π
-c,--container=""β Container name. If omitted, use thekubectl.kubernetes.io/default-containerannotation for selecting the container to be attached or the first container in the pod will be chosen. π«--pod-running-timeout=0β The length of time (like5s,2m, or3h, higher than zero) to wait until at least one pod is running. β³-q,--quiet=falseβ Only print output from the remote session. π€«-i,--stdin=falseβ Pass stdin to the container. π₯-t,--tty=falseβ Stdin is a TTY. π₯οΈ
π¦ OPTIONS INHERITED FROM PARENT COMMANDS π¦
these come from the parent command, so they're inherited β like getting your mom's good hair, but for flags. π
--as=""β Username to impersonate for the operation. User could be a regular user or a service account in a namespace. π--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. π¨ insecure, bestie.--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. π οΈ--match-server-version=falseβ Require server version to match client version. β-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. β±οΈ-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. β οΈ
π EXAMPLE π
okay bestie, here are the examples exactly as they live in the page β copy them, don't improvise, she's precise: π
# Get output from running pod mypod; use the 'oc.kubernetes.io/default-container' annotation
# for selecting the container to be attached or the first container in the pod will be chosen
oc attach mypod
# Get output from ruby-container from pod mypod
oc attach mypod -c ruby-container
# Switch to raw terminal mode; sends stdin to 'bash' in ruby-container from pod mypod
# and sends stdout/stderr from 'bash' back to the client
oc attach mypod -c ruby-container -i -t
# Get output from the first pod of a replica set named nginx
oc attach rs/nginx
π₯ SEE ALSO π₯
oc(1),β the parent manual, obviously. π
π HISTORY π
June 2016 β Ported from the Kubernetes man-doc generator. A little historical moment, and honestly? iconic. π
kisses and sparkles π β source/version Openshift / Openshift CLI User Manuals, June 2016. mwah π
π¦ 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