Home > Net >  Switch container runtime in K8S cluster. From CRI-O to docker
Switch container runtime in K8S cluster. From CRI-O to docker

Time:07-12

There is a working k8s cluster with two nodes(master and worker) in it, and with CRI-O as a container runtime. I need(temporary) to switch from cri-o to docker container runtime.

I was trying to use these commands: kubectl cordon <node_name> kubectl drain <node_name> and it was failed on master node.

CodePudding user response:

Here are some things to help you:

  1. Understand that dockershim support was removed from Kubernetes v1.24 . So, if your Kubernetes version is one of these, docker as a runtime will not work. This is a great resource in understanding the details of this.
  2. If your version allows using docker engine as a runtime, then as per the docs, you need to install the docker engine and then cri-dockerd adapter to interface it with Kubernetes. Links for all this you can find in the linked docs.
  3. After you're done installing and configuring your nodes, you will need to create a RuntimeClass object in your cluster. You can use this guide.
  4. Now, you need to update each pod specification to add the runtimeClass parameter to it, so it can be scheduled on the specified node.
  5. Understand that there is no "temporary" switching between runtimes. You simply install, configure and setup all the runtimes you need, in parallel, on your worker nodes and then update all of your pod specifications to schedule them on the worker node with the required RuntimeClass.
  6. Also, there is no point in changing a runtime of the master node. The master node pods are Kubernetes system components that are static pods and have their manifests at /etc/kubernetes/manifests directory. They are not applied through the Kubernetes API server. Any runtime changes on the node will not affect these pods unless the cluster is deleted and these pods are created again. It is HIGHLY DISCOURAGED to manipulate these manifests because any errors will not be shown anywhere and the component will simply "not work". (Hence, static pods).

Bottom line; Runtime changes only make sense for worker nodes. Do not try to change master node runtimes.

CodePudding user response:

[https://computingforgeeks.com/install-mirantis-cri-dockerd-as-docker-engine-shim-for-kubernetes/][1]

I have found an answer with the link above.

@zer0 Thanks for your post. In my case, I've been forced to change container runtime on master node as well. Docker run's as a container runtime in a cluster. Pods are running, app is working.

  • Related