bug: blade create k8s container-container remove
not works as expect
#1092
Labels
blade create k8s container-container remove
not works as expect
#1092
Issue Description
bug report
Describe what happened (or what feature you want)
There is a bug in the implementation of container deletion logic for the Containerd runtime in
chaosblade-exec-cri
. The current implementation only removes metadata from the bucket usingContainerService().Delete`, but it does not properly delete the associated task (including processes) or the container's rootfs snapshot.This issue causes Kubelet to fail to update the container state via CRI, which prevents new containers from being created for the affected Pod.
Describe what you expected to happen
The target container restarted with a non-zero exit code like 137.
How to reproduce it (as minimally and precisely as possible)
blade create k8s container-container remove
to remove a container in a Pod of Kubernetes.kubectl exec -it $THE_TARGET_POD -c $TARGET_CONTAINER -- bash
leads an internal error from CRI for container not found.Tell us your environment
Anything else we need to know?
I think the whole
chaosblade-exec-cri
implementation doesn't make a lot of sense and deviates from thecri
in the repo's name (It means interacting with the container runtime via the CRI interface)The compromise is to refer to containerd
cmd/ctr/commands/containers/containers.go
to remove containers and their associated resources.Here is some examples worked on my env to fix:
Use
containerd.Container
Use existed containerd client's Service API
Use
k8s.io/cri-client
The above will restart the container in the Pod with a restart record.
The text was updated successfully, but these errors were encountered: