LinuxCommandLibrary

kubectl-attach

TLDR

Attach to running container

$ kubectl attach [pod-name]
copy
Attach to specific container in pod
$ kubectl attach [pod-name] -c [container-name]
copy
Attach with stdin enabled
$ kubectl attach -it [pod-name]
copy

SYNOPSIS

kubectl attach [options] pod-name

DESCRIPTION

kubectl attach attaches to a running container in a pod. Allows interacting with processes already running in the container. Unlike exec, attach connects to the main container process rather than starting a new one.

PARAMETERS

-c, --container name

Container name in multi-container pod.
-i, --stdin
Pass stdin to container.
-t, --tty
Allocate TTY for container.
-n, --namespace name
Kubernetes namespace.

SEE ALSO

Copied to clipboard