How to Install CRI-O on Ubuntu For Kubernetes? (Guide)

In this article, I will give you a step-by-step tutorial for installing the cri-o container runtime for the Kubernetes configuration using Ubuntu.

Here is what you should know about crio.

  1. cri-o is an open-source container runtime that was created by the open-source community to replace the Docker engine on Kubernetes.
  2. cri-o is a stable container engine that runs OCI-compliant runtimes.
  3. cri-o is very stable because it is developed along with Kubernetes.

How To Install CRI-O on Ubuntu?

To install cri-o runtime on Ubuntu, follow the four steps below.

Step 1: Add the cri-o repository from OpenSUSE

The cri-o repository from the openSUSE repo must first be added. We are using version 1.23.

OS=xUbuntu_20.04
CRIO_VERSION=1.23
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/ /"|sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
echo "deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/$CRIO_VERSION/$OS/ /"|sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable:cri-o:$CRIO_VERSION.list

Step 2: Add the cri-o gpg keys

To validate the downloaded software, add the cri-o gpg release key.

curl -L https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$VERSION/$OS/Release.key | sudo apt-key --keyring /etc/apt/trusted.gpg.d/libcontainers.gpg add -
curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/Release.key | sudo apt-key --keyring /etc/apt/trusted.gpg.d/libcontainers.gpg add -

Step 3: Update and install cri-o

Now just Install & run an update. packages crio and crio-runc.

sudo apt-get update
sudo apt-get install cri-o cri-o-runc cri-tools -y

Step 4: Reload and enable cri-o

Activate the crio utility to start on reboots & reload the systemd confirmations.

sudo systemctl daemon-reload
sudo systemctl enable crio --now

Step 5: Verify cri-o installation using crictl

The cri-tools package should include the crictl utility. The CLI is what interacts with cri-o.

sudo crictl info

Now a JSON output should appear as displayed below.

{
  "status": {
    "conditions": [
      {
        "type": "RuntimeReady",
        "status": true,
        "reason": "",
        "message": ""
      },
      {
        "type": "NetworkReady",
        "status": false,
        "reason": "NetworkPluginNotReady",
        "message": "Network plugin returns error: No CNI configuration file in /etc/cni/net.d/. Has your network provider started?"
      }
    ]
  }
}

Final Thoughts

A container runtime like cri-o is required for the kubeadm Kubernetes setup. Also, it is a key idea in Kubernetes certification examinations.

I recommend you check out the CKA exam guide if you’re getting ready for the Kubernetes certification and take advantage of the CKA coupon code 2023 for registration discounts.

Check out the top Kubernetes tutorials if you’re learning this technology.

Leave a Reply

Your email address will not be published. Required fields are marked *