CRI-O is an open-source container runtime for Kubernetes that is optimized for running containers on Linux. It is designed to be lightweight and modular and to provide a stable, reliable platform for running containers in a production environment.
CRI-O is built on top of the Open Container Initiative (OCI) runtime specification, which defines a standard interface for running containers in a Linux environment. It works in conjunction with the Kubernetes Container Runtime Interface (CRI) to provide a stable, flexible platform for running containers in a Kubernetes cluster.
CRI-O supports a wide range of container images, including Docker, and offers a number of features to make it easier to manage and operate containers in a production environment. These features include support for image signing, image garbage collection, and resource constraints for containers.
CRI-O is a popular choice for running containers on Kubernetes and is used by many organizations to manage their containerized applications. It is supported on a wide range of Linux distributions, including Ubuntu, CentOS, and Red Hat Enterprise Linux (RHEL).
To install CRI-O on Ubuntu, follow these steps:
Step 1: Add the CRI-O repository to your system
export VERSION_ID=$(cat /etc/os-release | grep VERSION_ID | awk -F"=" '{print $2}' | tr -d '"')
export OS_VERSION=xUbuntu_$VERSION_ID
export CRIO_VERSION=1.25
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS_VERSION/ /"|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_VERSION/ /"|sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable:cri-o:$CRIO_VERSION.list
curl -L https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$VERSION/$OS_VERSION/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_VERSION/Release.key | sudo apt-key --keyring /etc/apt/trusted.gpg.d/libcontainers.gpg add -
Step 2: Install CRI-O
apt-get update
apt-get install cri-o cri-o-runc cri-tools -y
Step 3: Enable and Start the CRI-O service
systemctl daemon-reload
systemctl enable crio --now
Step 4: Validate CRI-O Service
sudo crictl info
{
"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?"
}
]
}
}
crictl ps
CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID POD
Note: that these steps are specific to Ubuntu and CRI-O 1.25. If you are using a different version, you may need to adjust the commands accordingly.
This article is created based on experience but If you discover any corrections or enhancements, please write a comment in the comment section or email us at contribute@devopsforu.com. You can also reach out to us from Contact-Us Page.
Follow us on LinkedIn for updates!
2 thoughts on “How to install CRI-O in Ubuntu”