Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke sh from $PATH instead of hard-coded location for postStart and preStop events #1339

Open
AObuchow opened this issue Nov 1, 2024 · 0 comments
Labels
enhancement New feature or request info-needed

Comments

@AObuchow
Copy link
Collaborator

AObuchow commented Nov 1, 2024

Description

Currently, postStart and preStop events assume the sh binary is located in /bin/sh/. However, this is not always the case, as discussed here, where sh is actually located in /usr/bin/sh.

I'm opening this issue to investigate whether it's possible to simply invoke sh in the Kubernetes PostStart lifecycle hook and have it expanded to the appropriate location on $PATH rather than hard-coding the location of sh to /bin/sh/.

I'm hopeful this is possible, as the Debugging Hook Handlers section of the Kubernetes docs show an error where a specific command was not found on $PATH:

Events:
  Type     Reason               Age              From               Message
  ----     ------               ----             ----               -------
(...)
  Warning  FailedPostStartHook  4s (x2 over 5s)  kubelet            Exec lifecycle hook ([badcommand]) for Container "lifecycle-demo-container" in Pod "lifecycle-demo_default(30229739-9651-4e5a-9a32-a8f1688862db)" failed - error: command 'badcommand' exited with 126: , message: "OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: \"badcommand\": executable file not found in $PATH: unknown\r\n"

@AObuchow AObuchow added enhancement New feature or request info-needed labels Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request info-needed
Projects
None yet
Development

No branches or pull requests

1 participant