Skip to content

Fix: Correct sidecar container termination order in pod lifecycle doc #51506

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

intojhanurag
Copy link
Contributor

This PR corrects a documentation bug where the shutdown order of containers in a Pod was previously stated incorrectly.

Problem

The earlier version claimed that sidecar containers are terminated after the main container, which contradicts the actual behavior.

Fix

Updated the doc to reflect that sidecar containers are stopped before the main application container, as per Kubernetes implementation.

References

/sig node

@k8s-ci-robot k8s-ci-robot added sig/node Categorizes an issue or PR as relevant to SIG Node. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 3, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign salaxander for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added language/en Issues or PRs related to English language size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 3, 2025
@intojhanurag
Copy link
Contributor Author

Hi @salaxander ! Kindly requesting a review for this small documentation fix.

Copy link

netlify bot commented Jul 3, 2025

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit d772a7d
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-io-main-staging/deploys/6866bbee95cbfe00087f8182
😎 Deploy Preview https://deploy-preview-51506--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

@lmktfy lmktfy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/hold

I believe the docs are correct here. Can you provide evidence they are not?

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 3, 2025
@intojhanurag
Copy link
Contributor Author

/hold

I believe the docs are correct here. Can you provide evidence they are not?

Thanks for the review!

You're right to ask for verification. This fix is based on a test shared by Alexandru Gheorghe in the #sig-node Slack channel, where the actual pod shutdown logs showed the sidecar was stopped before the main container:

Normal Created 96s kubelet Created container: myapp
Normal Started 96s kubelet Started container myapp
Normal Killing 29s kubelet Stopping container logshipper
Normal Killing 29s kubelet Stopping container myapp

He confirmed this behavior even when the main container had a 10-second delay on shutdown.

The full conversation is available here:
🔗 https://kubernetes.slack.com/archives/C0BP8PW9G/p1746008313521029?thread_ts=1746008313.521029&cid=C0BP8PW9G

You had suggested in that same thread that this might be a docs bug and encouraged filing a PR — so I’ve opened this PR as a follow-up to that suggestion.

@lmktfy
Copy link
Contributor

lmktfy commented Jul 3, 2025

@kubernetes/sig-node-pr-reviews please look at this.

I have concerns. I think sidecar containers should wait for the app container to stop before the sidecars start to terminate; I suspect that the current documentation accurately describes the current behavior.

Can you provide a technical review to confirm that the change is correct? Although I triaged the issue as accepted, I personally have not verified how Kubernetes actually works.


@intojhanurag would you be willing to provide a manifest for a Job that demonstrates that the commits in this PR are correct? If so please include any appropriate annotations etc.

@intojhanurag
Copy link
Contributor Author

@kubernetes/sig-node-pr-reviews please look at this.

I have concerns. I think sidecar containers should wait for the app container to stop before the sidecars start to terminate; I suspect that the current documentation accurately describes the current behavior.

Can you provide a technical review to confirm that the change is correct? Although I triaged the issue as accepted, I personally have not verified how Kubernetes actually works.

@intojhanurag would you be willing to provide a manifest for a Job that demonstrates that the commits in this PR are correct? If so please include any appropriate annotations etc.

Sure, thanks for raising this!
I’ll prepare a test manifest to demonstrate the behavior and share the results shortly.
Looking forward to SIG Node’s feedback as well.

@k8s-ci-robot
Copy link
Contributor

@intojhanurag: Reiterating the mentions to trigger a notification:
@kubernetes/sig-node-pr-reviews

In response to this:

@kubernetes/sig-node-pr-reviews please look at this.

I have concerns. I think sidecar containers should wait for the app container to stop before the sidecars start to terminate; I suspect that the current documentation accurately describes the current behavior.

Can you provide a technical review to confirm that the change is correct? Although I triaged the issue as accepted, I personally have not verified how Kubernetes actually works.

@intojhanurag would you be willing to provide a manifest for a Job that demonstrates that the commits in this PR are correct? If so please include any appropriate annotations etc.

Sure, thanks for raising this!
I’ll prepare a test manifest to demonstrate the behavior and share the results shortly.
Looking forward to SIG Node’s feedback as well.

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-sigs/prow repository.

@matthyx
Copy link
Contributor

matthyx commented Jul 4, 2025

/cc

@k8s-ci-robot k8s-ci-robot requested a review from matthyx July 4, 2025 05:14
@intojhanurag
Copy link
Contributor Author

Hi @lmktfy,

I've tried setting up a Job and Pod with signal traps in Minikube to capture container shutdown order, but couldn’t consistently observe termination logs — possibly due to how fast the pod exits or log collection behavior.

That said, I still believe the issue is valid based on the Slack thread. If someone from SIG Node could validate or reproduce the behavior from their side, that would really help.

Totally okay if the PR needs to be paused or closed for now — thank you for your time and review!

/cc @kubernetes/sig-node-pr-reviews

@k8s-ci-robot
Copy link
Contributor

@intojhanurag: GitHub didn't allow me to request PR reviews from the following users: kubernetes/sig-node-pr-reviews.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

Hi @lmktfy,

I've tried setting up a Job and Pod with signal traps in Minikube to capture container shutdown order, but couldn’t consistently observe termination logs — possibly due to how fast the pod exits or log collection behavior.

That said, I still believe the issue is valid based on the Slack thread. If someone from SIG Node could validate or reproduce the behavior from their side, that would really help.

Totally okay if the PR needs to be paused or closed for now — thank you for your time and review!

/cc @kubernetes/sig-node-pr-reviews

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-sigs/prow repository.

@k8s-ci-robot
Copy link
Contributor

@intojhanurag: Reiterating the mentions to trigger a notification:
@kubernetes/sig-node-pr-reviews

In response to this:

Hi @lmktfy,

I've tried setting up a Job and Pod with signal traps in Minikube to capture container shutdown order, but couldn’t consistently observe termination logs — possibly due to how fast the pod exits or log collection behavior.

That said, I still believe the issue is valid based on the Slack thread. If someone from SIG Node could validate or reproduce the behavior from their side, that would really help.

Totally okay if the PR needs to be paused or closed for now — thank you for your time and review!

/cc @kubernetes/sig-node-pr-reviews

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-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. language/en Issues or PRs related to English language sig/node Categorizes an issue or PR as relevant to SIG Node. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Development

Successfully merging this pull request may close these issues.

4 participants