Skip to content
masterclass Buddy

Kubernetes · Command

kubectl exec

kubectl exec runs a command inside a container in a Kubernetes Pod. Use -- to separate kubectl options from the command, and use -c to choose a container when needed.

Last updated

Syntax

kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • kubectl logs
  • kubectl get
  • kubectl describe
  • kubectl apply

Source: kubectl exec | Kubernetes. Checked 2026-11-03.