DELAPARRA
Index
Color
NL
Category: Kubernetes

exec

Explained by Updated

What is exec?

exec: Run a command inside a running container — usually an interactive shell for debugging. kubectl exec runs a command inside a running container. kubectl exec -it web-7d9f8c -- sh opens an interactive shell, and kubectl exec deploy/web -- php artisan migrate runs a one-off command. It is the standard way to look inside a container when something is wrong: check a config file, test a database connection, or run a maintenance command.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about exec

What should you keep in mind with exec?

Treat it as a diagnostic tool. Changes you make inside a container by hand are lost when the pod restarts, so real fixes belong in the image or the manifests. Many production images are minimal and have no shell at all, which is good for security. For those, kubectl debug can attach a temporary debugging container to the pod without changing the original image.

What does an example of exec look like?

kubectl exec -it web-7d9f8c-abc12 -- sh

At a glance

CategoryKubernetes
Explained by
Updated

More Kubernetes terms

All terms starting with E

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.