Warm tip: This article is reproduced from stackoverflow.com, please click
prometheus

Logging into running pods

发布于 2020-04-08 23:46:55

I am running prometheus in Kubernetes and trying to login to the running pod using the command below.

kubectl exec -it POD_NAME /bash

Error

ERRO[0000] exec failed: container_linux.go:346: starting container process caused "exec: \"bash\": executable file not found in $PATH" exec failed: container_linux.go:346: starting container process caused "exec: \"bash\": executable file not found in $PATH"

How to login to this running prometheus pod?

Questioner
user1578872
Viewed
53
DT. 2020-02-01 14:43

Container image doesn't contain /bin/bash, which is what Kube defaults to use to exec into the running container.

As a workaround you can try use kubectl and use /bin/sh.

Example: kubectl exec -it -- /bin/sh