-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
improve how cni and cruntimes work together #11184
Comments
I'm not sure there is anything that minikube can do about this, Kubernetes says that installing a CNI means that it will be used. It doesn't support having software configured that is not supposed to be used, in So as soon as you add I think the only way forward is to remove the configuration from the cri-o and podman packaging. cri-o/etc podman/etc containerd.io/etc cri-containerd-cnietc/ PS. That containerd systemd unit is just a packaging bug, it was But the kubeadm documentation doesn't install containerd from containerd.io, they install it from docker.com https://kubernetes.io/docs/setup/production-environment/container-runtimes/#containerd Note that containerd.io (docker-containerd) ships with a configurating to
This is why kubeadm has to-reconfigure it (re-enable the plugin), as part of the installation instructions.
|
You have already seen how the
There is a hack to skip reporting /run/containerd/containerd.sock when /var/run/docker.sock is present. foundCRISockets := []string{}
knownCRISockets := []string{
// Docker and containerd sockets are special cased below, hence not to be included here
"/var/run/crio/crio.sock",
}
if isSocket(dockerSocket) {
// the path in dockerSocket is not CRI compatible, hence we should replace it with a CRI compatible socket
foundCRISockets = append(foundCRISockets, constants.DefaultDockerCRISocket)
} else if isSocket(containerdSocket) {
// Docker 18.09 gets bundled together with containerd, thus having both dockerSocket and containerdSocket present.
// For compatibility reasons, we use the containerd socket only if Docker is not detected.
foundCRISockets = append(foundCRISockets, containerdSocket)
} |
Once we start running CRI for docker (with Kubernetes 1.22), it means that we will have to use criSocket for it. Currently cri-dockerd defaults to running on https://github.com/dims/cri-dockerd
But you could use |
i think that the fact that now, minikube tries to take away that burden off from the user to still be able to have the 'local kubernetes experience' and thus trying to figure out what it can do best with all different combinations that users have on their development machines or they might want to try out (eg, cgroupfs comes to mind - ref: https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm/#kubeadm-blocks-waiting-for-control-plane-during-installation, https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/#using-the-cgroupfs-driver, https://kubernetes.io/docs/setup/production-environment/container-runtimes/#cgroup-drivers, etc.), while also keeping itself fast and as small as possible (which is all a bit conflicting requirements, given the complexity minikube tries to solve here) i would expect that this specific issue will eventually be addressed upstream and that workarounds such as this one would not be necessary, and in the meantime - we can keep trying to provide the best possible experience for minikube users :) what gives hope is that this specific 'issue' of conflicting cohabitating cni configurations was already elegantly (better yet - properly) solved by crio (and podman) (ref: containers/podman#2370 and cri-o/cri-o#2121) or, if i understood what you are suggesting above, we might also decide to take a different route and create separate 'environments' for those different combinations, but then it would probably impose some other challenges - eg, the overall 'size' of such solution, potential additional slowdowns introduced, complexities of maintaining those different combos, etc. all in all, in that meantime, the pr connected to this issue is an improvement over the previous initial implementation in that it centralised where and how the 'necessary workaround' is triggered (and can be more easily changed/expanded/switched-off if needed - in cni.configureCNI), changes are adapted to a specific cruntime & cni used and they happen early enough so that additional restarts (and thus slowdowns) are avoided, etc. |
The "lexicographic order" thing doesn't work, for instance the kindnet CNI is bootstrapped from a pod. So it expects Kubernetes to be crash-looping, and any installed CNI will take precedence (over a not-yet-existing one) and prevent it from working correctly. So we need to ask podman to stay away from using * /etc/containers/containers.conf [network]
# Path to directory where CNI plugin binaries are located.
#
# cni_plugin_dirs = ["/usr/libexec/cni"]
# The network name of the default CNI network to attach pods to.
# default_network = "podman"
# Path to the directory where CNI configuration files are located.
#
# network_config_dir = "/etc/cni/net.d/" Same with flannel, or what have you. volumes:
- name: cni
hostPath:
path: /etc/cni/net.d https://github.com/flannel-io/flannel/blob/master/Documentation/kube-flannel.yml |
that's why in this 'workaround' we are pointing "/etc/cni/net.mk" to be used for kindnet cni instead so that kindnet pod gets initialised correctly while other 'relevant' pods (like coredns) stay in the pending state waiting for kindnet to become operational? |
completely agree, and atm only in the case of crio cr it only takes 'cni_default_network' flag (so no need for any kind of workaround) |
if i remember correctly, cilium, for example, does not need a workaround either as it restarts 'relevant' pods (incl coredns) after it's deployed - that is a decent solution i think, but not all cni used it what do you suggest? |
CRI-O is perfectly fine to install /etc/crictl.yaml (for CRI) and /etc/cni/net.d/100-crio-bridge.conf (for CNI) - |
I think we need to leave /etc/crictl.yaml and /etc/cni/net.d empty, by removing them from the packaging. Also, the long-term plan is to install only the container runtime that is actually going to be used: #9989 |
Besides changing the Podman configuration, I also need to change the BuildKit configuration.
The idea is to have them use a separate bridge for building, as opposed to cri-o or containerd ? |
that makes sense too - do you mind please creating a pr that would check if it solves this issue? |
crio is the only container runtime atm that allows specifying cni network that should be used (via 'cni_default_network' config param) and, unlike containerd or docker, it doesn't need custom kubelet's '--cni-conf-dir' flag to avoid conflicting CNI configs in default /etc/cni/net.d, so we can used that to improve how cni & cruntime work together (especially for multinode), while also avoiding later runtime reconfiguration and restart
/assign
The text was updated successfully, but these errors were encountered: