kubectl execIT technician command center
Containers · Docker and Kubernetes

kubectl exec

Run a command inside a Kubernetes pod.

Copy-ready commandkubectl exec
kubectl exec -it -n production pod/web-abc123 -- /bin/sh

Requirements and permissions

Requirements
Docker Engine, Docker Compose, or kubectl
Permissions
Container or cluster permissions vary
Last reviewed
2026-07-31

Examples

Basic example

Run a command inside a Kubernetes pod.

kubectl exec -it -n production pod/web-abc123 -- /bin/sh

Common errors

Command not found

Confirm Docker Engine, Docker Compose, or kubectl is installed and available in your current shell.