Kubernetes is moving aways from docker to alternative container engines presenting a smaller core having just the functionality needed. The two most populars alternatives are:
- containerd, a subset of docker, used for instance in Google Kubernetes Engine
- cri-o, a new implementation of a container engine, used for instance in Red Hat's Kubernetes offering (OpenShift)
These alternatives are meant to be used programatically via a unix domain socket, and therefore have a limited command line interface.
Let's play around in a VM.
Install a throwaway VM with Vagrant
apt install vagrant vagrant-libvirt
vagrant init debian/testing64
Start the VM, install dependencies
vagrant up
vagrant ssh
sudo apt update
sudo apt install --yes curl gnupg jq
Install cri-o the container engine
sudo bash
export OS=Debian_Testing VERSION=1.20
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/ /" > /etc/apt/sources.list.d/libcontainers.list
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/$VERSION/$OS/ /" > /etc/apt/sources.list.d/cri-o:$VERSION.list
curl -L https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$VERSION/$OS/Release.key | apt-key add -
curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/Release.key | apt-key add -
apt install cri-o cri-o-runc containernetworking-plugins conntrack
Verify it is running properly
systemctl restart cri-o
systemctl status cri-o
...
Started Container Runtime Interface for OCI (CRI-O).
Say hello to cri-o via its unix domain socket
curl --silent --unix-socket /var/run/crio/crio.sock http://localhost/info | jq
{
"storage_driver": "overlay",
"storage_root": "/var/lib/containers/storage",
"cgroup_driver": "systemd",
"default_id_mappings": {
"uids": [
{
"container_id": 0,
"host_id": 0,
"size": 4294967295
}
],
"gids": [
{
"container_id": 0,
"host_id": 0,
"size": 4294967295
}
]
}
}
Install crictl, a Kubernetes debugging tool for containers
wget --directory-prefix=/tmp https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.20.0/crictl-v1.20.0-linux-amd64.tar.gz
tar -xaf /tmp/crictl-v1.20.0-linux-amd64.tar.gz -C /usr/local/sbin/
chmod +x /usr/local/sbin/crictl
crictl info
{
"status": {
"conditions": [
{
"type": "RuntimeReady",
"status": true,
"reason": "",
"message": ""
},
{
"type": "NetworkReady",
"status": true,
"reason": "",
"message": ""
}
]
}
}
From there on you can create a container following the examples in https://github.com/kubernetes-sigs/cri-tools/blob/master/docs/crictl.md
No comments:
Post a Comment