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

cri support restart exited containers #10213

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

soulfy
Copy link

@soulfy soulfy commented May 11, 2024

image

In production environment, users may want to restart containers, those in the Exited state, instead of creating new containers. Docker can do it.

@k8s-ci-robot
Copy link

Hi @soulfy. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@soulfy soulfy force-pushed the cri-start-exited-containers branch from f8c74b1 to 398605c Compare May 11, 2024 03:24
In production environment, users may want to restart containers, those in the Exited state, instead of creating new containers.
Docker can do it.

Signed-off-by: soulfy <soulfy@163.com>
@soulfy soulfy force-pushed the cri-start-exited-containers branch from 398605c to 6be69d6 Compare May 11, 2024 03:48
Signed-off-by: soulfy <soulfy@163.com>
Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

Hi, it's not accepted to support restart. Docker API is total different with CRI.
Kubernetes doesn't support to restart exited container. If you want to support it, please file KEP to kubernetes first. Thanks. Closing

REF: #6763

@fuweid fuweid closed this May 11, 2024
@soulfy
Copy link
Author

soulfy commented May 11, 2024

Why not consider starting with runtime support first, and then pushing the upper-level callers in the reverse direction.
This functional requirements do come from actual application scenarios.
Anyway, adding an new ability isn't a bad thing, right?

@fuweid
Copy link
Member

fuweid commented May 11, 2024

Why not consider starting with runtime support first, and then pushing the upper-level callers in the reverse direction.

It's related to life-cycle change. I don't think we should support this case which is conflicted with kubelet behavior. Please see the following comment.

If you're going to extend API with annotation or enhance with runtime-level concepts, like image snapshot which is not available to kubelet, it sounds good. But for this, I will vote -1.

This functional requirements do come from actual application scenarios.

If you're using kubernetes, kubelet won't call Start after exited. Kubelet will delete that container. It looks conflict to me. So, it seems that you are using CRI in non-kubernetes scenario. Why use CRI to support non-kubernetes case? You can use containerd to build your own plugin. It's already supported.

Anyway, adding an new ability isn't a bad thing, right?

For me, -1 to support restart case. You can reopen this and ping other maintainers comment.

Wei

@soulfy
Copy link
Author

soulfy commented May 11, 2024

thanks for your response.

we are in a custom kubernetes scenario. for this, we did some modification in kubelet.

@fuweid
Copy link
Member

fuweid commented May 11, 2024

we are in a custom kubernetes scenario. for this, we did some modification in kubelet.

I see. Guess that it's stateful application.

Reopen this and wait for other maintainers' comment.
However, I still vote -1 for this :p.

@fuweid fuweid reopened this May 11, 2024
@soulfy
Copy link
Author

soulfy commented May 12, 2024

we are in a custom kubernetes scenario. for this, we did some modification in kubelet.

I see. Guess that it's stateful application.

Reopen this and wait for other maintainers' comment. However, I still vote -1 for this :p.

thanks. expecting happy ending 😁

@kzys
Copy link
Member

kzys commented May 15, 2024

I generally agree with what @fuweid said. CRI is for Kubernetes and I don't want to make that more complex for supporting what Kubernetes wouldn't do.

This functional requirements do come from actual application scenarios.

Why do you (or your applications) want to restart a container instead of making a new one?

@soulfy
Copy link
Author

soulfy commented May 16, 2024

Why do you (or your applications) want to restart a container instead of making a new one?

Some applications migrated from VM have not yet fully adapted to containerization, so we provide such a transition method

@samuelkarp
Copy link
Member

we are in a custom kubernetes scenario. for this, we did some modification in kubelet.

I'm not really in favor of modifying containerd in order to support custom forks of Kubernetes. If Kubernetes adds support for container restarts (as opposed to delete/recreate) then that would be a good reason to support it in containerd.

@samuelkarp samuelkarp added the status/needs-discussion Needs discussion and decision from maintainers label May 16, 2024
Signed-off-by: soulfy <soulfy@163.com>
@ningmingxiao
Copy link
Contributor

ningmingxiao commented May 20, 2024

some users cp a new jar to the container,and restart it to perform a quick verification. Instead of make a new image(it will waste more time). I want to find some method to solve this problem.
may like
1.ctr pause a container
2. kubectl cp (or nedctl cp) a new binary into container
3. ctr resume a container
but now ctr pause will not suppport that.

@soulfy
Copy link
Author

soulfy commented May 21, 2024

but now ctr pause will support that.

i think pause/resume action is different from restarting a exited container.
the exited status indicates that the process in the container has actively or passively exited, while the pause status indicates that the process is frozen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ok-to-test size/M status/needs-discussion Needs discussion and decision from maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants