Welcome to the Linux Foundation Forum!

Lab 4.2 - containerd rather than docker

Is there a guide to using containerd rather than docker for running containers given it'll be removed in 1.24 and this lab currently uses 1.23?
https://kubernetes.io/blog/2022/01/07/kubernetes-is-moving-on-from-dockershim/

"LFS260/SOLUTIONS/s_04/k8scp.sh" sets up kubernetes using docker rather than containerd

Thanks!

Best Answers

  • richardoc
    richardoc Posts: 5
    edited May 4 Answer ✓

    Fixed this by doing the following to both LFS260/SOLUTIONS/s_04/k8scp.sh and LFS260/SOLUTIONS/s_04/k8sWorker.sh

    Remove the following section


    and adding the following instead

    echo "Install and configure containerd"
    sleep 2
    sudo mkdir -p /etc/containerd
    
    sudo apt install -y containerd
    
    sudo containerd config default | sudo tee /etc/containerd/config.toml
    
    sudo systemctl restart containerd
    
    sudo systemctl enable containerd
    
    

    and changing

    sudo apt-get install -y kubeadm=1.23.1-00 kubelet=1.23.1-00 kubectl=1.23.1-00
    

    to

    sudo apt-get install -y kubeadm=1.23.1-00 kubelet=1.23.1-00 kubectl=1.23.1-00 --allow-downgrades --allow-change-held-packages
    

    due to some issues with the node I was using.

    I hope this helps!

  • richardoc
    richardoc Posts: 5
    Answer ✓

    Fixed this by doing the following tto LFS260/SOLUTIONS/s_04/k8scp.sh

    Remove the following section

    echo "Install and configure Docker"
    sleep 2
    
    sudo apt-get install -y docker.io
    
    cat <<EOF | sudo tee /etc/docker/daemon.json
    {
      "exec-opts": ["native.cgroupdriver=systemd"],
      "log-driver": "json-file",
      "log-opts": {
        "max-size": "100m"
      },
      "storage-driver": "overlay2"
    }
    EOF
    
    sudo systemctl enable docker
    
    sudo systemctl daemon-reload
    
    sudo systemctl restart docker
    

    and adding the following instead

    echo "Install and configure containerd"
    sleep 2
    sudo mkdir -p /etc/containerd
    
    sudo apt install -y containerd
    
    sudo containerd config default | sudo tee /etc/containerd/config.toml
    
    sudo systemctl restart containerd
    
    sudo systemctl enable containerd
    
    

    and changing

    sudo apt-get install -y kubeadm=1.23.1-00 kubelet=1.23.1-00 kubectl=1.23.1-00
    

    to

    sudo apt-get install -y kubeadm=1.23.1-00 kubelet=1.23.1-00 kubectl=1.23.1-00 --allow-downgrades --allow-change-held-packages
    

    finally, change

    sudo kubeadm init --kubernetes-version 1.23.1 --pod-network-cidr 192.168.0.0/16 --cri-socket "unix:///var/run/containerd/containerd.sock"
    

    to

    sudo kubeadm init --kubernetes-version 1.23.1 --pod-network-cidr 192.168.0.0/16  --cri-socket "unix:///var/run/containerd/containerd.sock"
    

    For LFS260/SOLUTIONS/s_04/k8sWorker.sh

    Remove the following section

    echo "Install and configure Docker"
    sleep 2
    
    sudo apt-get install -y docker.io
    
    cat <<EOF | sudo tee /etc/docker/daemon.json
    {
      "exec-opts": ["native.cgroupdriver=systemd"],
      "log-driver": "json-file",
      "log-opts": {
        "max-size": "100m"
      },
      "storage-driver": "overlay2"
    }
    EOF
    
    sudo systemctl enable docker
    
    sudo systemctl daemon-reload
    
    sudo systemctl restart docker
    

    and adding the following instead

    echo "Install and configure containerd"
    sleep 2
    sudo mkdir -p /etc/containerd
    
    sudo apt install -y containerd
    
    sudo containerd config default | sudo tee /etc/containerd/config.toml
    
    sudo systemctl restart containerd
    
    sudo systemctl enable containerd
    
    

    and changing

    sudo apt-get install -y kubeadm=1.23.1-00 kubelet=1.23.1-00 kubectl=1.23.1-00
    

    to

    sudo apt-get install -y kubeadm=1.23.1-00 kubelet=1.23.1-00 kubectl=1.23.1-00 --allow-downgrades --allow-change-held-packages
    

    Finally, when running the kubeadm join command, add --cri-socket "unix:///var/run/containerd/containerd.sock"

    Eg

    ```bash

    sudo kubeadm join 172.31.254.12:6443 --token super.token --discovery-token-ca-cert-hash sha256:superCA --cri-socket "unix:///var/run/containerd/containerd.sock"

    I hope this helps!

Categories

Upcoming Training