Introduction
Sometimes you need to look inside a running container to check logs, files, or run commands. kubectl exec lets you open a terminal inside a container to do this directly.
When you want to debug a running application by checking its files or logs inside the container.
When you need to run a quick command inside a container without changing its image or restarting it.
When you want to inspect the environment variables or configuration inside a container.
When you want to test connectivity or run network commands inside a container.
When you want to manually fix a problem inside a container before automating a solution.