Skip to content

Race condition in containerd restart when using --container-runtime=containerd and containerd was previously initialized #10355

@krezovic

Description

@krezovic

I'm running minikube on SLES 12.5 on bare-metal machine, and I'm aware of the warning that containerd with --driver=none is experimental. However, it seemed to work once, but not anymore with 1.17.1. There seems to be a race condition where crictl command is called before containerd is fully started. Following command is ran as root user, hence no sudo (I'm fully aware of the issues that may arise).

KUBERNETES_VERSION=v1.20.2
SERVER_ADDRESS=redacted

minikube start --driver=none --apiserver-ips="${SERVER_ADDRESS}" --apiserver-port=6443 \
               --embed-certs=true --install-addons=false --kubernetes-version="${KUBERNETES_VERSION}" \
               --container-runtime=containerd --cni=calico

Full output of minikube start command used, if not already included:

😄  minikube v1.17.1 on Suse 12.5
✨  Using the none driver based on user configuration
❗  Using the 'containerd' runtime with the 'none' driver is an untested configuration!
👍  Starting control plane node minikube in cluster minikube
🤹  Running on localhost (CPUs=8, Memory=64159MB, Disk=40962MB) ...
ℹ️  OS release is SUSE Linux Enterprise Server 12 SP5
📦  Preparing Kubernetes v1.20.2 on containerd 1.4.3 ...

❌  Exiting due to K8S_INSTALL_FAILED: updating control plane: generating kubeadm cfg: getting cgroup driver: get cri info: sudo crictl info: exit status 1
stdout:

stderr:
time="2021-02-03T10:14:44+01:00" level=fatal msg="getting status of runtime: rpc error: code = Unknown desc = server is not initialized yet"


😿  If the above advice does not help, please let us know: 
👉  https://github.com/kubernetes/minikube/issues/new/choose

If I run sudo crictl info, I get the JSON output the command expects. So there seems to be a race condition between writing a containerd.toml file, restarting containerd and issuing crictl command to get the cgroup driver.

I have found out that this happens when containerd is previously initialized in /var/lib/containerd and has lots of data. If I wipe all containerd data, containerd will start up much faster, and the same command will succeed.

😄  minikube v1.17.1 on Suse 12.5
✨  Using the none driver based on user configuration
❗  Using the 'containerd' runtime with the 'none' driver is an untested configuration!
✅  Using image repository reg-hrpap.app.corpintra.net/infrastructure
👍  Starting control plane node minikube in cluster minikube
🤹  Running on localhost (CPUs=8, Memory=64159MB, Disk=40962MB) ...
ℹ️  OS release is SUSE Linux Enterprise Server 12 SP5
📦  Preparing Kubernetes v1.20.2 on containerd 1.4.3 ...
    ▪ Generating certificates and keys ...
    ▪ Booting up control plane ...
    ▪ Configuring RBAC rules ...
🔗  Configuring Calico (Container Networking Interface) ...
🤹  Configuring local host environment ...

❗  The 'none' driver is designed for experts who need to integrate with an existing VM
💡  Most users should use the newer 'docker' driver instead, which does not require root!
📘  For more information, see: https://minikube.sigs.k8s.io/docs/reference/drivers/none/

❗  kubectl and minikube configuration will be stored in /root
❗  To use kubectl or minikube commands as your own user, you may need to relocate them. For example, to overwrite your own settings, run:

    ▪ sudo mv /root/.kube /root/.minikube $HOME
    ▪ sudo chown -R $USER $HOME/.kube $HOME/.minikube

💡  This can also be done automatically by setting the env var CHANGE_MINIKUBE_NONE_USER=true
🔎  Verifying Kubernetes components...
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions