Migrating Container Runtime in GKE

abhishek
3 min readJul 17, 2022

We already came to know that, Kubernetes has deprecated Docker as container runtime after v1.20. This doesn’t mean any docker based container will be not able to run in Kubernetes. The container runtime will still able to pull and run images created from Docker.

From Kubernetes v1.24, it’s important to change your container runtime to Containerd in GKE to work flawlessly. After you came to know that you still using Docker as container runtime, you can easily migrate your running container runtime to Containerd by following few steps.

Don’t know which container runtime you are using currently? Use this command to know which container runtime you’re using.

gcloud container node-pools list --cluster GKE_CLUSTER_NAME --zone CLUSTER_ZONE --format="table(name,version,config.imageType)"

or you can also use cloud console to check.

Under GKE console → Click on Cluster → Nodes → under Node Pools Click on each node pool → under Nodes details you can see Image type.

If you see this Container-Optimized OS with containerd (cos_containerd) or any another runtime with containerd, then you’re good to go. No action required.

Migrating Container Runtime to Containerd can be done using both way from i.e by using gcloud command or from cloud console.

Using gcloud command

gcloud container clusters upgrade CLUSTER_NAME --zone CLUSTER_ZONE_NAME --image-type=COS_CONTAINERD  --node-pool=NODE_POOL_NAME

Using GCP Console

Get inside the cluster from GKE Console.

Under Nodes section, you have your node-pools list, click on Node Pools name, [here default-pool]

It will represent all the node-pools details like size, networking, management etc. At the top click on Edit button. Inside that, you can edit some node related items. Under Nodes section, you can see image type that can be changed.

Click on change and you’ll have list of container runtime. You can select any one based on your need. By default, it will go with cos_containerd from GKE v1.24.

If you have ubuntu based nodes, you can use ubuntu_containerd.

After confirmation, your cluster will start updating nodes image type.

Remember, during this update time you won’t be able to do GKE operations like, getting inside cluster to make some changes. Deployment may get on halt until upgrade get succeed. So you should plan accordingly.

What if your workloads start acting abnormal after upgrade? 🤔

You can again change back to previous image type and plan your workload test for containerd image type node.

Don’t want these self maintenance in future? 😛

you can try having look at GKE Autopilot.

--

--

abhishek

Finished college, and then started in DevOps. Not a Omniscient 😉