OC(1)

πŸ“¦
version 4.22.0 Β· 2 versions
, in nixpkgs unstable

πŸ’… 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 the kubectl.kubernetes.io/default-container annotation 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 (like 5s, 2m, or 3h, 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 exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=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