替換flanneld 安裝 Calico


    1. 替換flannel 需要確保當前無正在運行的Container
    2. 關閉flanneld服務
    3. iptables -F -t nat && iptables -F
    4. 修改docker.service文件

      修改原本的ExecStart 設置etcd的地址,線上應該是 181,182,183三台

      #ExecStart=/usr/bin/dockerd  --ip-masq=false --bip=${FLANNEL_SUBNET} --mtu=${FLANNEL_MTU}
       
      ExecStart= /usr/bin/dockerd  --cluster-store=etcd: // <etcdendpoint>:<etcdport> --cluster-store-opt kv.cacertfile= /path/to/ca .pem \
           --cluster-store-opt kv.certfile= /path/to/cert .pem \
           --cluster-store-opt kv.keyfile= /path/to/key .pem

      其中  --cluster-store-opt 中的ca, cert, key 文件查看當前機器flanneld.service文件中的配置,例如(-etcd-keyfile=/root/etcd_ssl/client-key.pem --etcd-certfile=/root/etcd_ssl/client.pem --etcd-cafile=/root/etcd_ssl/ca.pem)其中文件對應的路徑。

    5. systemctl daemon-reload && systemctl restart docker
    6. 下載分發calicoctl文件版本1.6.x(查看附件)到每台機器
    7. docker pull calico/node:v2.6.11 
    8. docker pull adiazmor/docker-ubuntu-with-ping (用於測試,有其他鏡像代替也可以)

    9. 編寫配置文件位於/etc/calico/calicoctl.cfg

      apiVersion: v1
      kind: calicoApiConfig
      metadata:
      spec:
         etcdEndpoints: https: // <etcd_addr>:2379,https: // <etcd_addr>:2379,https: // <etcd_addr>:2379
         etcdKeyFile: <path to key>
         etcdCertFile: <path to cert>
         etcdCACertFile: <path to ca>
    10. calicoctl node run --node-image=calico/node:v2.6.11 --ip=<本機IP,如果是40g網絡則對應17段的ip>

    11. docker network create --driver calico --ipam-driver calico-ipam calico-net1
    12. docker network create --driver calico --ipam-driver calico-ipam calico-net2
    13. 在任意幾台機器上分別創建 docker run --rm -it --network calico-net1 adiazmor/docker-ubuntu-with-ping  /bin/bash
    14. 用 ip a 查看當前ip 然后分別去ping其他同樣加入了calico-net1  的ip 應該是可以ping通的
    15. 在任意幾台機器上分別創建 docker run --rm -it --network calico-net2 adiazmor/docker-ubuntu-with-ping  /bin/bash
    16. 同樣在calico-net2中的Container可以ping通,但是ping不通在calico-net1中的container


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM