一、 安装CENTOS7两台,一台做master,一台做node
Mast :192.168.140.101 Node: 192.168.140.102
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache
yum -y update yum -y install vim wget
二、 MASKTER部署
1安装etcd kubernetes
yum -y install etcd kubernetes
2配置etcd
Vim /etc/etcd/etcd.conf
ETCD_NAME=default
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://localhost:2379"
3配置kubernetes
vim /etc/kubernetes/apiserver
KUBE_API_ADDRESS="--address=0.0.0.0"KUBE_API_PORT="--port=8080"
KUBELET_PORT="--kubelet_port=10250"
KUBE_ETCD_SERVERS="--etcd_servers=http://127.0.0.1:2379"
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16"
KUBE_ADMISSION_CONTROL="--admission_control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ResourceQuota"
KUBE_API_ARGS=""
4配置服务自启动,启动服务:启动etcd, kube-apiserver, kube-controller-manager and kube-scheduler服务
for sername in etcd kube-apiserver kube-controller-manager kube-scheduler; do systemctl restart $sername ;systemctl enable $sername; systemctl status $sername; done
5设置etcd网络
etcdctl -C //192.168.140.101:2379 set /atomic.io/network/config '{"Network":"10.1.0.0/16"}'
6 master设置完成,查询node的状态
kubectl get nodes
三、nodes安装
1 安装flannel kubernetes
yum -y install flannel kubernetes
2配置kubernetes连接到服务端IP
Vim /etc/kubernetes/config
KUBE_MASTER="--master=http://192.168.140.101:8080"
KUBE_ETCD_SERVERS="--etcd_servers=http://192.168.140.101:2379"
3 配置kubernetes
KUBELET_ADDRESS="--address=0.0.0.0" KUBELET_PORT="--port=10250" # You may leave this blank to use the actual hostname ##KUBELET_HOSTNAME="--hostname-override=127.0.0.1" KUBELET_API_SERVER="--api-servers=http://192.168.140.101:8080" KUBELET_ARGS=""
4 配置flannel网络
Vim /etc/sysconfig/flanneld
FLANNEL_ETCD_ENDPOINTS="http://192.168.140.101:2379" FLANNEL_ETCD_PREFIX="/atomic.io/network"
5 启动服务
for SERVICES in flanneld kube-proxy kubelet docker do systemctl restart $SERVICES systemctl enable $SERVICES systemctl status $SERVICES Done