WORKDIR/test #如果没有会自动创建test目录 WORKDIR demo RUN pwd# 输出结果应该是/test/demo
/etc/docker/daemon.json添加insecure-registries
/lib/systemd/system/docker.service添加EnvironmentFile
ip netns add test
ip netns list
ip netns exec test ip a
ip link
ip netns exec test ip link set dev lo up
ip link add veth-test1 type veth peer name veth-test2
ip link set veth-test1 netns test
ip link set veth-test2 netns test2
ip netns exec test1 ip addr add 192.168.1.1/24 dev veth-test1
ip netns exec test2 ip addr add 192.168.1.2/24 dev veth-test2
ip netns exec test1 ip link set dev veth-test1 up
ip netns exec test1 ip link set dev veth-test2 up
ip netns exec test1 ping 192.168.1.2
docker network ls
yum install bridge-utils
brctl
docker network create -d bridge my-bridge
docker network connect my-bridge 容器名
nohup ./etcd --name docker-node1 --initial-advertise-peer-urls http://192.168.205.10:2380 \ --listen-peer-urls http://192.168.205.10:2380 \ --listen-client-urls http://192.168.205.10:2379,http://127.0.0.1:2379 \ --advertise-client-urls http://192.168.205.10:2379 \ --initial-cluster-token etcd-cluster \ --initial-cluster docker-node1=http://192.168.205.10:2380,docker-node2=http://192.168.205.11:2380 \ --initial-cluster-state new&
nohup ./etcd --name docker-node2 --initial-advertise-peer-urls http://192.168.205.11:2380 \ --listen-peer-urls http://192.168.205.11:2380 \ --listen-client-urls http://192.168.205.11:2379,http://127.0.0.1:2379 \ --advertise-client-urls http://192.168.205.11:2379 \ --initial-cluster-token etcd-cluster \ --initial-cluster docker-node1=http://192.168.205.10:2380,docker-node2=http://192.168.205.11:2380 \ --initial-cluster-state new&
./etcdctl cluster-health
在docker-node1上
$ sudo service docker stop $ sudo /usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock --cluster-store=etcd://192.168.205.10:2379 --cluster-advertise=192.168.205.10:2375&
在docker-node2上
$ sudo service docker stop $ sudo /usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock --cluster-store=etcd://192.168.205.11:2379 --cluster-advertise=192.168.205.11:2375&
-v mysql:/var/lib/mysql
docker-compose up --scale servicename = n
启动多个
docker swarm init --advertise-addr=192.168.205.10
--advertise-addr (ip could be found through "docker-machine Is")
swarm join --token ********** 192.168.205.10:2377
docker service
docker service scale service=replics
docker network create -d overlay demo docker service create --name mysql --env MYSQL_ROOT_PASSWORD=root --env MYSQL_DATABASE=wordpree --mount type=volume,source=mysql-data,destination=/var/lib/mysql mysql docker service create --name wordpress -p 80:80 --env WORDPRESS_DB_PASSWORD=root --env WORDPRESS_DB_HOST=mysql --network demo wordpress
docker network create -d overlay demo docker service create --name whoami -p 8080:8080 --network demo -d jwilder/whoami docker service create --name client -d --network demo busydbox sh -c "while true;do sleep 3600; done"
iptables -nL -t nat 查看本地ip转发规则 iptables -nL -t mangle # mangle表主要用于修改数据包的TOS(Type Of Service,服务类型)、TTL(Time To Live,生存周期)指以及为数据包设置Mark标记,以实现Qos(Quality Of Service,服务质量)调整以及策略路由等应用 brctl show 查询网桥信息 nsenter --net=/var/run/docker/netns/ingress_sbox 进入 ingress_sbox ipvsadm -l ipvsadm是LVS在应用层的管理命令,可以看到负载均衡到的两个ip
Pod运行多个容器,Service中多个Pod
Deployment中可以运行多个容器或者Pod
Node 是 Pod 真正运行的主机,可以是物理机,也可以是虚拟机。
ControllerManager 维护集群状态,扩缩容,故障检测,Scheduler 资源调度,ETCD 一致性存储
Kubernetes scheduler-preselect
Kubernetes scheduler-optimize-select
Kubernetes服务发现
认证方式
鉴权
集群方案