Command

Kubernetes Run a Command in a Pod Command

The Kubernetes command to run a command in a pod is kubectl exec my-pod -- ls /.

Quick Answer

Command
kubectl exec my-pod -- ls /
KubernetesCommand

Run a Command in a Pod

Type this command
kubectl exec my-pod -- ls /

Runs a command in an existing pod.

Learn More

How to run a command in a pod in Kubernetes

  1. Open the terminal or command interface for Kubernetes.
  2. Type kubectl exec my-pod -- ls /, replace any placeholders, and run it.

Kubernetes Run a Command in a Pod Command

Run kubectl exec my-pod -- ls /.

Related Commands

Frequently asked questions

What is the Kubernetes command to run a command in a pod?

Run kubectl exec my-pod -- ls /.

Where do I type this Kubernetes command?

Type it in the terminal or command-line interface used by Kubernetes.

Does this Kubernetes command work on Mac and Windows?

Yes. The command text is the same on both platforms when the tool is installed.

Official source · How we verify