zoukankan      html  css  js  c++  java
  • calico实现docker容器内部的网络链接

    calico官网

    https://www.projectcalico.org//

    calico介绍

    http://www.sdnlab.com/17161.html

    calico网络

    环境

    系统   centos 7.2

    ip      10.0.0.51

    IP      10.0.0.61

    1.下载etcd

     wget https://github.com/coreos/etcd/releases/download/v3.0.4/etcd-v3.0.4-linux-amd64.tar.gz

    tar xf etcd-v3.0.4-linux-amd64.tar.gz

    cd etcd-v3.0.4-linux-amd64

    cp etcd /usr/bin/etcd && cp etcdctl /usr/bin/etcdctl

    2.链接etcd集群

    calico1执行

    etcd --name infra0   --initial-advertise-peer-urls http://10.0.0.51:2380   --listen-peer-urls http://10.0.0.51:2380   --listen-client-urls http://10.0.0.51:2379,http://127.0.0.1:2379   --advertise-client-urls http://10.0.0.51:2379   --initial-cluster-token etcd-cluster-1   --initial-cluster infra0=http://10.0.0.51:2380,infra1=http://10.0.0.61:2380   --initial-cluster-state new &

    calico2执行

    etcd --name infra0   --initial-advertise-peer-urls http://10.0.0.61:2380   --listen-peer-urls http://10.0.0.61:2380   --listen-client-urls http://10.0.0.61:2379,http://127.0.0.1:2379   --advertise-client-urls http://10.0.0.61:2379   --initial-cluster-token etcd-cluster-1   --initial-cluster infra0=http://10.0.0.61:2380,infra1=http://10.0.0.51:2380   --initial-cluster-state new &

    3.查看

    etcdctl  member list

     

    docker配置

    1.下载doker

    yum install -y docker

    2.修改docker的配置文件

    calico1修改

    vim /usr/lib/systemd/system/docker.service

    ExecStart=/usr/bin/dockerd  $INSECURE_REGISTRY --cluster-store=etcd://10.0.0.51:2379

    calico2修改

    vim  /usr/lib/systemd/system/docker.service

    3.启动docker

    systemctl  daemon-reload

    systemctl  restart docker

    三.calico

    需要先下载calico/node    镜像

    1.下载calico并授权

     wget http://www.projectcalico.org/latest/calicoctl

    chmod +x calicoctl && mv calicoctl /usr/local/bin

    2.执行calico命令

    1.在本机执行

    calicoctl node run

    2.在另一台执行

     ETCD_ENDPOINTS=http://10.0.0.51:2379 calicoctl node run

    3.查看

    calicoctl  node status

    4.创建网络池

     cat > calico_pool_minion5.conf <<EOF

    apiVersion: v1
    kind: ipPool
    metadata:
      cidr: 10.1.0.0/16
    spec:
      ipip:
        enabled: false
      nat-outgoing: true
      disabled: false
    EOF
    5.创建pod
     calicoctl create -f calico_pool_minion5.conf
    6.创建网络
     docker network create -d calico --ipam-driver calico-ipam --subnet=10.1.0.0/16 net1
    docker network ls

    7.测试

  • 相关阅读:
    关于IE6不能兼容LCUC使用的PNG透明图象
    rmvb压制中高级技巧
    不错的课件网站
    C#程序多用户只启动一个进程的方法
    不可想像的加密光盘复制工具
    检测远程URL是否存在的三种方法
    请哪里有英文单词单复数转换的代码?
    一些感想,欢迎拍砖
    Some thoughts on my own O/R Mapping or Code Generation tools
    有了net send,谁还用IM?
  • 原文地址:https://www.cnblogs.com/zhangb8042/p/7822513.html
Copyright © 2011-2022 走看看