一、环境准备
1、主机
Centos7 ,最少3台以上,越多越好
CPU2个
内存1.5G+
主机名分别为node1,node2,node3,node4.......
关闭防火墙,selinux
时间同步
2、创建目录
mkdir /etc/systemd/system/docker.service.d
二、安装docker
1、复制docker.repo文件
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
2、复制163.repo文件
wget -O /etc/yum.repos.d/163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
3、安装docker
yum install docker-engine-17.03.1.ce-1.el7.centos -y
三、准备配置文件
1、/etc/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=network.target docker-storage-setup.service
Wants=docker-storage-setup.service
[Service]
Type=notify
Environment=GOTRACEBACK=crash
ExecReload=/bin/kill -s HUP $MAINPID
Delegate=yes
KillMode=process
ExecStart=/usr/bin/docker daemon \
$DOCKER_OPTS \
$DOCKER_STORAGE_OPTIONS \
$DOCKER_NETWORK_OPTIONS \
$DOCKER_DNS_OPTIONS \
$INSECURE_REGISTRY
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
TimeoutStartSec=1min
Restart=on-abnormal
[Install]
WantedBy=multi-user.target
2、/etc/systemd/system/docker.service.d/docker-options.conf
[Service]
Environment="DOCKER_OPTS=--insecure-registry=10.233.0.0/18 --graph=/var/lib/docker --log-opt max-size=50m --log-opt max-file=5 \
--iptables=false"
3、/etc/systemd/system/docker.service.d/docker-dns.conf
[Service]
Environment="DOCKER_DNS_OPTIONS=\
--dns 10.233.0.3 --dns 192.168.1.1 \
--dns-search default.svc.cluster.local --dns-search svc.cluster.local \
--dns-opt ndots:2 --dns-opt timeout:2 --dns-opt attempts:2 \
4、/etc/systemd/system/docker.service.d/docker-proxy 设置代理
[Service]
Environment="ALL_PROXY=socks5://192.168.1.107:1080"
设置代理可能会出现的问题
unauthorized: authentication required
这个是由于代理服务器在美国,本地确设置了上海的时区。在17.09的版本上就没有这个错误。
ln -s /usr/share/zoneinfo/US/Pacific /etc/localtime
四、启动docker
systemctl daemon-reload
systemctl start docker
systemctl enable docker
五、下载镜像
[root@localhost ~]# docker images | awk '{print $1":"$2}'
REPOSITORY:TAG
quay.io/coreos/hyperkube:v1.8.3_coreos.0
lachlanevenson/k8s-helm:2.7.0
andyshinn/dnsmasq:2.78
quay.io/coreos/flannel:v0.9.0
quay.io/coreos/flannel-cni:v0.3.0
quay.io/calico/ctl:v1.5.0
quay.io/calico/node:v2.5.0
quay.io/calico/kube-policy-controller:v0.7.0
xueshanf/install-socat:latest
quay.io/calico/cni:v1.10.0
quay.io/calico/routereflector:v0.4.0
quay.io/coreos/etcd:v3.2.4
gcr.io/google_containers/cluster-proportional-autoscaler-amd64:1.1.1
quay.io/l23network/k8s-netchecker-agent:v1.0
quay.io/l23network/k8s-netchecker-server:v1.0
gcr.io/google_containers/fluentd-elasticsearch:1.22
gcr.io/google_containers/elasticsearch:v2.4.1
gcr.io/google_containers/kibana:v4.6.1
nginx:1.11.4-alpine