This guide will walk you through the installation of CRI-O Container Runtime on Ubuntu 20.04/18.04. CRI-O is an OCI-based implementation of Kubernetes Container Runtime Interface (CRI) designed to provide an integration path between OCI conformant runtimes and the kubelet.
CRI-O is created to provide following core functionalities:
- Support multiple image formats including the existing Docker image format
- Support for multiple means to download images including trust & image verification
- Container image management (managing image layers, overlay filesystems, etc)
- Container process lifecycle management
- Monitoring and logging required to satisfy the CRI
- Resource isolation as required by the CRI
The libraries used by CRI-O are:
- Runtime: runc (or any OCI runtime-spec implementation) and oci runtime tools
- Images: Image management using containers/image
- Storage: Storage and management of image layers using containers/storage
- Networking: Networking support through use of CNI
We will use pre-built binary packages to install CRI-O container runtime. Follow the steps below to install CRI-O Container Runtime on Ubuntu 20.04|18.04.
Step 1: Update System
Ensure your Ubuntu system is updated. If you’re afraid this could break your system you can skip.
sudo apt update && sudo apt upgrade
It is recommended to reboot your system to ensure it is running on updated version.
sudo systemctl reboot
Step 2: Add CRI-O Kubic repository
Add the Kubic repository which host binary packages for Debian based systems. If using CRI-O with Kubernetes, install the version matching Kubernetes version you’ll setup.
If your Kubernetes version is 1.17, install CRI-O version 1.17.
CRIO_VERSION=1.17
. /etc/os-release
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/x${NAME}_${VERSION_ID}/ /' >/etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list"
Once the repository is added to your system, import GPG key:
wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/x${NAME}_${VERSION_ID}/Release.key -O- | sudo apt-key add -
Step 3: Install CRI-O on Ubuntu 20.04 | Ubuntu 18.04
When repository is added, update apt cache and install CRI-O on Ubuntu.
sudo apt update
sudo apt install cri-o-${CRIO_VERSION}
Accept installation prompt with y key.
The following additional packages will be installed:
conmon containers-common containers-golang containers-image libgpgme11 runc
Suggested packages:
containernetworking-plugins
The following NEW packages will be installed:
conmon containers-common containers-golang containers-image cri-o-1.17 libgpgme11 runc
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 23.3 MB of archives.
After this operation, 107 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Start and enable crio service:
sudo systemctl enable crio.service
sudo systemctl start crio.service
Service status can be checked with the command:
$ systemctl status crio
● crio.service - Container Runtime Interface for OCI (CRI-O)
Loaded: loaded (/lib/systemd/system/crio.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2020-06-07 20:16:50 CEST; 37s ago
Docs: https://github.com/cri-o/cri-o
Main PID: 2461 (crio)
Tasks: 13
Memory: 7.7M
CGroup: /system.slice/crio.service
└─2461 /usr/bin/crio
Jun 07 20:16:50 ubuntu systemd[1]: Starting Container Runtime Interface for OCI (CRI-O)...
Jun 07 20:16:50 ubuntu systemd[1]: Started Container Runtime Interface for OCI (CRI-O).
Step 4: Using CRI-O on Ubuntu 20.04 | 18.04
The command line tool crioctl can be installed through cri-tools package.
sudo apt install cri-tools
Check existence of crictl command:
$ crictl info
{
"status": {
"conditions": [
{
"type": "RuntimeReady",
"status": true,
"reason": "",
"message": ""
},
{
"type": "NetworkReady",
"status": false,
"reason": "NetworkPluginNotReady",
"message": "Network plugin returns error: Missing CNI default network"
}
]
}
}
Pull a test image:
# crictl pull nginx
Image is up to date for docker.io/library/[email protected]:c870bf53de0357813af37b9500cb1c2ff9fb4c00120d5fe1d75c21591293c34d
# crictl pull hello-world
Image is up to date for docker.io/library/[email protected]:6a65f928fb91fcfbc963f7aa6d57c8eeb426ad9a20c7ee045538ef34847f44f1
# crictl pull busybox
Image is up to date for docker.io/library/[email protected]:95cf004f559831017cdf4628aaf1bb30133677be8702a8c5f2994629f637a209
List available images:
# crictl images
IMAGE TAG IMAGE ID SIZE
docker.io/library/alpine latest a24bb4013296f 5.85MB
docker.io/library/busybox latest 1c35c44120825 1.44MB
docker.io/library/hello-world latest bf756fb1ae65a 20kB
docker.io/library/nginx latest 4392e5dad77db 136MB
Create pod sandbox config file:
cat >nginx.json<net-pod.json<<EOF
{
"metadata": {
"name": "networking",
"uid": "networking-pod-uid",
"namespace": "default",
"attempt": 1
},
"hostname": "networking",
"port_mappings": [
{
"container_port": 80
}
],
"log_directory": "https://computingforgeeks.com/tmp/net-pod",
"linux": {}
}
EOF
Run the pod
sudo crictl runp net-pod.json
sudo crictl create nginx.json net-pod.json
sudo crictl ps -a
Enjoy using CRI-O on Ubuntu with Kubernetes. If you want to master Kubernetes administration, checkout the courses below.
<img data-ezsrc="https://kirelos.com/wp-content/uploads/2020/06/echo/icon_udemy-com.png5ede263b38a19.jpg" ezimgfmt="rs rscb8 src ng ngcb8" src="data:image/svg xml,”>Udemy.com
<img data-ezsrc="https://kirelos.com/wp-content/uploads/2020/06/echo/icon_udemy-com.png5ede263b38a19.jpg" ezimgfmt="rs rscb8 src ng ngcb8" src="data:image/svg xml,”>Udemy.com
<img data-ezsrc="https://kirelos.com/wp-content/uploads/2020/06/echo/icon_udemy-com.png5ede263b38a19.jpg" ezimgfmt="rs rscb8 src ng ngcb8" src="data:image/svg xml,”>Udemy.com
For installation of CRI-O on CentOS Linux, refer to: