nigelpoulton / TheK8sBook

YAML files for use with The Kubernetes Book
822 stars 665 forks source link

kubectl exec: running commands in Pods #30

Closed logisin closed 1 year ago

logisin commented 1 year ago

Discussed in https://github.com/nigelpoulton/TheK8sBook/discussions/29

Originally posted by **logisin** January 1, 2023 The command `kubectl exec hello-pod -- ps aux` from chapter 4 section "Hands on with pods" gives the following message:
error: Internal error occurred: error executing command in container: failed to exec in container: failed to start exec "fc7ef1a745ffd71b0d28376f80ab706bf896fb8e13c501e66a2889286eda97f9": OCI runtime exec failed: exec failed: unable to start container process: exec: "ps": executable file not found in $PATH: unknown
In addition after executing the command `kubectl exec -it hello-pod -- sh` I get into the shell but the command `apk add curl ` responds with
sh: 1: apk: not found
nigelpoulton commented 1 year ago

This was my bad. I cahnged the base image to be a smaller one and... well... the smaller one didn't have the required utilities. Should be fixed if you clone the latest version of the repo.

Thanks for the heads-up.