need root
-
Run prepare.sh
-
Create file calicoctl.cfg in /etc/calico
- calicocfg/calicoctl.cfg.sample is an example of it, replace the ip with your etcd ip
-
Create ipPool.cfg in /etc/calico if you want to set your own ip pool (Default ip pool is 192.168.0.0/16)
- calicocfg/ipPool.cfg.sample is an example of it, replace the cidr with your own ip pool cidr
-
Create file in /etc/cni/net.d to define network (In calico, a profile is equal to a network in docker, I just create network manually)
- calicocfg/10-frontend-calico.conf is an example of it, replace the name with your own network name, make sure etcd_endpoints is correct
- you can create multiple .conf files to define different networks, containers in same network can communicate with each other, otherwisea they can't communicate.
-
Start etcd
etcd --name {NODENAME} --initial-advertise-peer-urls http://{IP}:2380 --listen-peer-urls http://{IP}:2380 --listen-client-urls http://{IP}:2379 --advertise-client-urls http://{IP}:2379 --initial-cluster-token {CLUSTERNAME} --initial-cluster {NODENAME}=http://{IP}:2380 --initial-cluster-state new &
- Configure and start docker
service docker stop
dockerd --cluster-store=etcd://{IP}:2379 &
- Run calico-node (Perhaps all nodes should run this command to upadte bgpPeers?)
calicoctl node run
-
If you want to set your own resource, do like this:
- calicoctl create -f /etc/calico/ipPool.cfg
-
Operations of lxc container:
- To create a lxc container:
./lxc-create.sh {CONTAINERNAME}
- To attach a container to a network:
./lxc-attach-calico.sh {CONTAINERNAME} {NETWORK}
- To detach a container from a network:
./lxc-detach-calico.sh {CONTAINERNAME} {NETWORK}
- To delete a lxc containre:
./lxc-delelte.sh {CONTAINERNAME}
-
TODO:
- build network in docklet(https://github.com/unias/docklet)