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

preStop lifecycle policy does not work due to missing sleep binary #43

Closed
supernothing opened this issue Oct 14, 2021 · 2 comments
Closed

Comments

@supernothing
Copy link

While debugging some transient DNS issues in a cluster today, I noticed the following error in the cluster event logs:

Exec lifecycle hook ([/usr/bin/sleep 15]) for Container "coredns" in Pod "coredns-coredns-8dbff79d6-kkp8n_kube-system(662883c5-3b59-46d5-9785-cb4146cdf3a6)" failed - error: rpc error: code = Unknown desc = failed to exec in container: failed to start exec "a6bf72f3d8f69ed29f82c49d1d2b3f1431ef56bd95de14bef845556fcfcfa93b": OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "/usr/bin/sleep": stat /usr/bin/sleep: no such file or directory: unknown, message: ""

I believe this change to the coredns base image led to the preStop lifecycle hook to no longer function correctly: coredns/coredns@a77d983 . Since /usr/bin/sleep doesn't exist, the coredns pod is terminated immediately instead of respecting the preStopSleep value.

I worked around this issue by building my own coredns image that had /usr/bin/sleep. Not sure the best way to fix this given the empty base image, but wanted to report it in case anyone else was experiencing the same issue.

@Kyslik
Copy link

Kyslik commented Feb 10, 2023

You can build your own with following DF:

FROM debian:11-slim AS tools

RUN apt update && apt upgrade -y

# For original Dockerfile
# See https://github.com/coredns/coredns/blob/master/Dockerfile
FROM docker.io/coredns/coredns:1.9.3

COPY --from=tools /bin/sleep /usr/bin/sleep
COPY --from=tools /lib/x86_64-linux-gnu/libc.so.6 /lib/x86_64-linux-gnu/libc.so.6
COPY --from=tools /lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2

@hagaibarel
Copy link
Collaborator

hagaibarel commented Sep 6, 2023

The preStopSleep option has been removed from the chart in #136 as the sleep binary is no longer present in the image

@hagaibarel hagaibarel mentioned this issue Nov 8, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants