Command line tool (kubectl) | Kubernetes

PHOTO EMBED

Fri May 31 2024 22:24:43 GMT+0000 (Coordinated Universal Time)

Saved by @calazar23

# Get output from running 'date' from pod <pod-name>. By default, output is from the first container.

kubectl exec <pod-name> -- date



# Get output from running 'date' in container <container-name> of pod <pod-name>.

kubectl exec <pod-name> -c <container-name> -- date



# Get an interactive TTY and run /bin/bash from pod <pod-name>. By default, output is from the first container.

kubectl exec -ti <pod-name> -- /bin/bash
content_copyCOPY

https://kubernetes.io/docs/reference/kubectl/