LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

kubectl-exec

executes a command in a container running in a pod

TLDR

Execute command in pod
$ kubectl exec [pod-name] -- [command]
copy
Open interactive shell
$ kubectl exec -it [pod-name] -- /bin/sh
copy
Execute in specific container
$ kubectl exec [pod-name] -c [container] -- [command]
copy
Execute bash in pod
$ kubectl exec -it [pod-name] -- /bin/bash
copy

SYNOPSIS

kubectl exec [options] pod-name -- command [args...]

DESCRIPTION

kubectl exec runs a command directly inside a container that is part of a running Kubernetes pod, functioning similarly to `docker exec`. It establishes a connection to the container's runtime environment through the Kubernetes API server and kubelet, allowing you to inspect files, run diagnostics, or open an interactive shell session.The double dash (--) is required to separate kubectl flags from the command and its arguments that should be passed to the container. When combined with -i (stdin) and -t (tty) flags, it provides a fully interactive terminal session. For pods with multiple containers, the -c flag lets you specify which container to target.

PARAMETERS

-c, --container name

Container name in multi-container pod.
-i, --stdin
Pass stdin to container.
-t, --tty
Allocate TTY.
-n, --namespace name
Kubernetes namespace.

INSTALL

sudo apt install kubectl
copy
sudo pacman -S kubectl
copy
sudo apk add kubectl
copy
brew install kubectl
copy
nix profile install nixpkgs#kubectl
copy

SEE ALSO

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid