kubernetes / minikube

Run Kubernetes locally
https://minikube.sigs.k8s.io/
Apache License 2.0
29.36k stars 4.87k forks source link

Frequent test failures of `TestPreload` #12217

Open minikube-bot opened 3 years ago

minikube-bot commented 3 years ago

This test has high flake rates for the following environments:

Environment Flake Rate (%)
QEMU_macOS 100.00
KVM_Linux_crio 100.00
spowelljr commented 1 year ago

My investigation found that all VM drivers using containerd or cri-o experience this issue.

I debugged the sudo crictl images --output json command and found that it returns exit code 0, however it also outputs the following to stderr:

time="2023-06-08T20:01:39Z" level=warning msg="image connect using default endpoints: [unix:///var/run/dockershim.sock unix:///run/containerd/containerd.sock unix:///run/crio/crio.sock]. As the default settings are now deprecated, you should set the endpoint instead."
time="2023-06-08T20:01:41Z" level=error msg="connect endpoint 'unix:///var/run/dockershim.sock', make sure you are running as root and the endpoint has been started: context deadline exceeded"
time="2023-06-08T20:01:43Z" level=error msg="connect endpoint 'unix:///run/containerd/containerd.sock', make sure you are running as root and the endpoint has been started: context deadline exceeded"

This is where the issue stems from as it checks if the preload images exist, but since it's erroring it's returning an empty image list. So minikube decides it needs to untar the preload. When it untars the preload, it overwrites the directory containing all the existing images, causing the error in the test where the busybox image isn't present.

This works fine on the kicbase however, I looked at the differences between the startup process and discovered that on kicbase, we only check for the existence of the preload once, after the CRIs are configured and started, however, the VM drivers check the preload twice, once before the CRIs are configured and started, and once after. This would explain why we're getting the error output above, which in turn is causing the preload to be untarred and overwrite the existing images when it shouldn't be.

My next steps are to figure out why we're checking for the existence of the preloads twice on VM drivers and remove the one prior to the CRI configuration.