Debugging
Publish date: Feb 4, 2023
Last updated: Feb 5, 2023
Last updated: Feb 5, 2023
View resource usage (top) of different pods
kc top pods -n namespace
Get a shell to the running container
kc exec --stdin --tty <pod-name> -n namespace -- /bin/bash
Note: The double dash
(--)
separates the arguments you want to pass to the command from the kubectl arguments.
List all environment variables in the running container
kc exec <pod-name> env -n namespace
Opening a shell when a Pod has more than one container
kc exec -i -t <pod-name> -n namespace --container main-app -- /bin/bash