1、注意测试环境在所有机器先关掉selinux
2、在master
1)配置网路
这里的dockhub.me是我个人的registry,也可以官方pull这些镜像
-
$ docker pull dockhub.me/louyuguang/etcd:2.2.1
-
$ master_ip=`ifconfig eth1 | grep 'inet ' | cut -d' ' -f10`
-
$ docker run -d \
-
--net=host \
-
--restart=always \
-
--name=etcd \
-
-v /var/etcd/data:/var/etcd/data \
-
d.qianyilc.com/louyuguang/etcd:2.2.1 \
-
/usr/local/bin/etcd \
-
--addr=$master_ip:4001 \
-
--bind-addr=0.0.0.0:4001 \
-
--data-dir=/var/etcd/data
-
-
$ docker exec -it etcd etcdctl set /myk8s/network/config '{"Network": "10.0.0.0/8"}'
-
$ wget -c https://github.com/coreos/flannel/releases/download/v0.5.5/flannel-0.5.5-linux-amd64.tar.gz
-
$ tar zxvf flannel-0.5.5-linux-amd64.tar.gz
-
$ sudo flannel-0.5.5/flanneld --etcd-endpoints=http://$master_ip:4001 --etcd-prefix=/qinghua.github.io/network --iface=eth1 > flannel.log 2>&1 &
-
$ cat flannel.log
2)修改docker的网络参数
-
$ source /run/flannel/subnet.env
-
$ echo --bip=$FLANNEL_SUBNET --mtu=$FLANNEL_MTU
-
将上面结果添加到docker启动选项里
3)安装k8s
-
$ wget -c https://github.com/kubernetes/kubernetes/releases/download/v1.2.0/kubernetes.tar.gz
-
$ tar zxvf kubernetes.tar.gz
-
$ tar zxvf kubernetes/server/kubernetes-server-linux-amd64.tar.gz
-
-
$ docker load -i kubernetes/server/bin/kube-apiserver.tar
-
$ docker load -i kubernetes/server/bin/kube-controller-manager.tar
-
$ docker load -i kubernetes/server/bin/kube-scheduler.tar
-
-
$ docker run -d \
-
--name=apiserver \
-
--net=host \
-
gcr.io/google_containers/kube-apiserver:e68c6af15d4672feef7022e94ee4d9af \
-
kube-apiserver \
-
--insecure-bind-address=$master_ip \
-
--service-cluster-ip-range=11.0.0.0/16 \
-
--etcd-servers=http://$master_ip:4001
-
-
$ docker run -d \
-
--name=cm \
-
gcr.io/google_containers/kube-controller-manager:b9107c794e0564bf11719dc554213f7b \
-
kube-controller-manager \
-
--master=$master_ip:8080
-
-
-
$ docker run -d \
-
--name=scheduler \
-
gcr.io/google_containers/kube-scheduler:903b34d5ed7367ec4dddf846675613c9 \
-
kube-scheduler \
-
--master=$master_ip:8080
3、在node
1)配置网络,注意将master节点的ip添加到配置中
-
$ wget -c https://github.com/coreos/flannel/releases/download/v0.5.5/flannel-0.5.5-linux-amd64.tar.gz
-
$ tar zxvf flannel-0.5.5-linux-amd64.tar.gz
-
$ sudo flannel-0.5.5/flanneld --etcd-endpoints=http://$master_ip:4001 --etcd-prefix=/qinghua.github.io/network --iface=eth1 > flannel.log 2>&1 &
-
$ cat flannel.log
2)修改docker网络参数
-
$ source /run/flannel/subnet.env
-
$ echo --bip=$FLANNEL_SUBNET --mtu=$FLANNEL_MTU
-
将上面结果添加到docker启动选项里
3)安装k8s
-
$ wget -c https://github.com/kubernetes/kubernetes/releases/download/v1.2.0/kubernetes.tar.gz
-
$ tar zxvf kubernetes.tar.gz
-
$ tar zxvf kubernetes/server/kubernetes-server-linux-amd64.tar.gz
-
-
$ node_ip=`ifconfig eth1 | grep 'inet ' | cut -d' ' -f10`
-
$ sudo kubernetes/server/bin/kubelet --api-servers=$master_ip:8080 --node-ip=$node_ip > kubelet.log 2>&1 &
-
$ sudo kubernetes/server/bin/kube-proxy --master=$master_ip:8080 > proxy.log 2>&1 &
阅读(4716) | 评论(0) | 转发(0) |