安装cni网络插件-非必须

Posted effortsing

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装cni网络插件-非必须相关的知识,希望对你有一定的参考价值。

安装cni网络插件


安装cni
# 安装 cni
# 百度云链接:https://pan.baidu.com/s/1-PputObLs5jouXLnuBCI6Q 密码:tzqm
cd /server/software/k8s
wget https://github.com/containernetworking/plugins/releases/download/v0.7.1/cni-plugins-amd64-v0.7.1.tgz
mkdir -pv /opt/cni/bin
tar xf cni-plugins-amd64-v0.7.1.tgz -C /opt/cni/bin
ls -l /opt/cni/bin
cd $HOME


vi /etc/cni/net.d/10-mynet.conf

{
    "cniVersion": "0.7.0",
    "name": "mynet",
    "type": "bridge",
    "bridge": "cni0",
    "isGateway": true,
    "ipMasq": true,
    "ipam": {
        "type": "host-local",
        "subnet": "172.30.0.0/16",
        "routes": [
            { "dst": "0.0.0.0/0" }
        ]
    }
}


cat >/etc/cni/net.d/99-loopback.conf <<EOF
{
    "cniVersion": "0.6.0",
    "name": "lo",
    "type": "loopback"
}
EOF



获取subnet:


etcdctl   --endpoints=${ETCD_ENDPOINTS}   --ca-file=/etc/kubernetes/cert/ca.pem   --cert-file=/etc/flanneld/cert/flanneld.pem   --key-file=/etc/flanneld/cert/flanneld-key.pem   ls ${FLANNEL_ETCD_PREFIX}/subnets

/kubernetes/network/subnets/172.30.43.0-24
/kubernetes/network/subnets/172.30.49.0-24
/kubernetes/network/subnets/172.30.30.0-24
/kubernetes/network/subnets/172.30.44.0-24


echo 1 > /sys/devices/virtual/net/docker0/bridge/nf_call_iptables

插件必须设置net/bridge/bridge-nf-call-iptables sysctl为1,以确保iptables代理功能正常。

参照地址: k8s这区文档:   https://k8smeetup.github.io/docs/concepts/cluster-administration/network-plugins/

 

以上是关于安装cni网络插件-非必须的主要内容,如果未能解决你的问题,请参考以下文章

K8S-SRIOV及multus CNI安装测试

Kubernetes_CNI_01_Calico

从零开始入门 K8s | 理解 CNI 和 CNI 插件

理解CNI和CNI插件

非全研究生计算机网络-k8s网络插件(CNI)性能分析

非全研究生计算机网络-k8s网络插件(CNI)性能分析