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

Container Lifecycle Hooks exit on non-0 exit code #102841

Closed
Manu10744 opened this issue Jun 14, 2021 · 6 comments
Closed

Container Lifecycle Hooks exit on non-0 exit code #102841

Manu10744 opened this issue Jun 14, 2021 · 6 comments
Labels
kind/documentation Categorizes issue or PR as related to documentation. kind/support Categorizes issue or PR as a support question. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. sig/node Categorizes an issue or PR as relevant to SIG Node. triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@Manu10744
Copy link

Manu10744 commented Jun 14, 2021

Hi,

i don't understand why Container Lifecycle Hooks are instantly killed by Kubernetes (Exit Code 137) when some command is used that returns a non-0 exit code. Sometimes this is expected behavior and i don't understand why this is not possible with Kubernetes.

For example, in a postStart lifecycle hook, if i am trying to wait for a webservice inside the container to be running like so:

ATTEMPT_COUNTER=0
        MAX_ATTEMPTS=12
        until curl --connect-timeout 2 --silent --output /dev/null --fail https:/mypage. de/tasks/definitions; do
            if [ \${ATTEMPT_COUNTER} -eq \${MAX_ATTEMPTS} ]; then
                echo "Container didnt answer in time. "
                exit 1
            fi 

            ATTEMPT_COUNTER=\$((\$ATTEMPT_COUNTER+1))
            sleep 10
        done

then this will fail instantly as soon as the first curl command fails on Connection refused.

@k8s-ci-robot k8s-ci-robot added the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Jun 14, 2021
@k8s-ci-robot
Copy link
Contributor

@Manu10744: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jun 14, 2021
@neolit123
Copy link
Member

/kind support
/sig node

@k8s-ci-robot k8s-ci-robot added kind/support Categorizes issue or PR as a support question. sig/node Categorizes an issue or PR as relevant to SIG Node. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jun 14, 2021
@alberthuang24
Copy link

alberthuang24 commented Jun 15, 2021

https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/#discussion.

The Container's state will only change to Running when the postStart hook is successfully executed,

so I don't understand what your question is?

It is also recommended to provide the kubectl version output to help us locate which kubernetes version is the problem

@Manu10744

@alberthuang24
Copy link

/triage needs-information

@k8s-ci-robot k8s-ci-robot added the triage/needs-information Indicates an issue needs more information in order to work on it. label Jun 15, 2021
@ehashman
Copy link
Member

Kubernetes does not use issues on this repo for support requests. If you have a question on how to use Kubernetes or to debug a specific issue, please visit our forums.

It looks like we have some documentation for this already as linked by @HongjiangHuang but I will also mark this with a docs tag.

/kind documentation
/close

@k8s-ci-robot k8s-ci-robot added the kind/documentation Categorizes issue or PR as related to documentation. label Jun 24, 2021
@k8s-ci-robot
Copy link
Contributor

@ehashman: Closing this issue.

In response to this:

Kubernetes does not use issues on this repo for support requests. If you have a question on how to use Kubernetes or to debug a specific issue, please visit our forums.

It looks like we have some documentation for this already as linked by @HongjiangHuang but I will also mark this with a docs tag.

/kind documentation
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/documentation Categorizes issue or PR as related to documentation. kind/support Categorizes issue or PR as a support question. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. sig/node Categorizes an issue or PR as relevant to SIG Node. triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests

5 participants