美文网首页
安装 crictl 工具和 cni 插件

安装 crictl 工具和 cni 插件

作者: 偷油考拉 | 来源:发表于2024-02-27 15:55 被阅读0次

    一、手动安装 crictl 工具

    https://github.com/kubernetes-sigs/cri-tools

    建议手动下载 https://github.com/kubernetes-sigs/cri-tools/tags

    VERSION="v1.29.0"
    
    wget https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-$VERSION-linux-amd64.tar.gz
    sudo tar zxvf crictl-$VERSION-linux-amd64.tar.gz -C /usr/local/bin
    rm -f crictl-$VERSION-linux-amd64.tar.gz
    
    wget https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/critest-$VERSION-linux-amd64.tar.gz
    sudo tar zxvf critest-$VERSION-linux-amd64.tar.gz -C /usr/local/bin
    rm -f critest-$VERSION-linux-amd64.tar.gz
    

    增加软链接到 /usr/bin ,有些时候 /usr/local/bin 不在 $PATH 中,会报错。

    ln -s /usr/local/bin/crictl /usr/bin/crictl
    ln -s /usr/local/bin/critest /usr/bin/critest
    

    创建配置文件 /etc/crictl.yaml

    runtime-endpoint: unix:///run/containerd/containerd.sock
    

    二、手动安装 cni 插件

    https://github.com/containernetworking/plugins
    https://minikube.sigs.k8s.io/docs/faq/#how-do-i-install-containernetworking-plugins-for-none-driver

    建议手动下载。

    CNI_PLUGIN_VERSION="v1.4.0"
    CNI_PLUGIN_TAR="cni-plugins-linux-amd64-$CNI_PLUGIN_VERSION.tgz"
    CNI_PLUGIN_INSTALL_DIR="/opt/cni/bin"
    
    curl -LO "https://github.com/containernetworking/plugins/releases/download/$CNI_PLUGIN_VERSION/$CNI_PLUGIN_TAR"
    sudo mkdir -p "$CNI_PLUGIN_INSTALL_DIR"
    sudo tar -xf "$CNI_PLUGIN_TAR" -C "$CNI_PLUGIN_INSTALL_DIR"
    rm "$CNI_PLUGIN_TAR"
    

    三、yum 安装

    https://developer.aliyun.com/mirror/kubernetes

    cat <<EOF | tee /etc/yum.repos.d/kubernetes.repo
    [kubernetes]
    name=Kubernetes
    baseurl=https://mirrors.aliyun.com/kubernetes-new/core/stable/v1.28/rpm/
    enabled=1
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/kubernetes-new/core/stable/v1.28/rpm/repodata/repomd.xml.key
    EOF
    setenforce 0
    yum install -y kubelet kubeadm kubectl
    systemctl enable kubelet && systemctl start kubelet
    

    这个步骤会安装 kubeadm、kubectl、kubelet、conntrack-tools、cri-toolskubernetes-cni、libnetfilter_cthelper、libnetfilter_cttimeout、libnetfilter_queue、socat 包。

    [root@VM-201-11-centos ~]# rpm -ql cri-tools
    /usr/bin/crictl
    /usr/share/doc/packages/cri-tools
    /usr/share/doc/packages/cri-tools/README.md
    /usr/share/licenses/cri-tools
    /usr/share/licenses/cri-tools/LICENSE
    
    [root@VM-201-11-centos ~]# rpm -ql kubernetes-cni
    /etc/cni
    /etc/cni/net.d
    /opt/cni
    /opt/cni/bin
    /opt/cni/bin/bandwidth
    /opt/cni/bin/bridge
    /opt/cni/bin/dhcp
    /opt/cni/bin/dummy
    /opt/cni/bin/firewall
    /opt/cni/bin/host-device
    /opt/cni/bin/host-local
    /opt/cni/bin/ipvlan
    /opt/cni/bin/loopback
    /opt/cni/bin/macvlan
    /opt/cni/bin/portmap
    /opt/cni/bin/ptp
    /opt/cni/bin/sbr
    /opt/cni/bin/static
    /opt/cni/bin/tuning
    /opt/cni/bin/vlan
    /opt/cni/bin/vrf
    /usr/share/doc/packages/kubernetes-cni
    /usr/share/doc/packages/kubernetes-cni/README.md
    /usr/share/licenses/kubernetes-cni
    /usr/share/licenses/kubernetes-cni/LICENSE
    

    相关文章

      网友评论

          本文标题:安装 crictl 工具和 cni 插件

          本文链接:https://www.haomeiwen.com/subject/mqatzdtx.html