码迷,mamicode.com
首页 > 其他好文 > 详细

k8s 1.5.2 安装脚本

时间:2018-02-23 18:54:56      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:技术   bak   脚本   dock   bind   else   int   分享图片   rest   

技术分享图片
 1 #!/bin/bash
 2 export RED=\E[1;31m
 3 export RES=\E[0m
 4 export GRN=\E[1;32m
 5 master_input=`echo  -e " ${RED} 输入master主机ip  ${RES}"`
 6 #node_input=`echo  -e "${GRN} 输入第${i}node主机ip ${RES}"`
 7 node_number=`echo  -e "${GRN} 输入node的数量 ${RES}"`
 8 
 9 echo  -e " ${RED} 开始安装master端  ${RES}"
10 read -p "$node_number" num
11 if [ -z `echo ${num}|sed "s/[0-9]//g"` ];then 
12     echo "${RED} ${num}台node ${RES}"
13     for ((i=1;i<=$num;i++));do export  node_input=`echo  -e "${GRN} 输入第${i}node主机ip ${RES}"`;read -p "$node_input" node$i_ip;done
14 else
15     echo -e " ${RED} 输入有误!!${RES}"
16     exit 1
17 fi
18 
19 hostname master
20 echo "`ip a s eth0|awk -F ‘[ /]+‘ ‘NR==3{print $3}‘` master " >>/etc/hosts
21 for ((i=1;i<=$num;i++));do  echo "$node$i_ip   node$i" >>/etc/hosts;done
22 
23 cat >>/etc/yum.repos.d/virt7-docker-common-release.repo<<EOF
24 [virt7-docker-common-release]
25 name=virt7-docker-common-release
26 baseurl=http://cbs.centos.org/repos/virt7-docker-common-release/x86_64/os/
27 gpgcheck=0
28 EOF
29 
30 yum -y install --enablerepo=virt7-docker-common-release kubernetes etcd flannel
31 
32 sed -ri.bak s#(--master=http://)(.*)(:8080)#\1master\3#g /etc/kubernetes/config 
33 sed -i.bak s#--insecure-bind-address=127.0.0.1#--insecure-bind-address=0.0.0.0#g /etc/kubernetes/apiserver
34 sed s#,ServiceAccount##g /etc/kubernetes/apiserver
35 systemctl restart etcd.service  kube-apiserver.service  kube-controller-manager.service  kube-scheduler.service
36 systemctl enable etcd.service  kube-apiserver.service  kube-controller-manager.service  kube-scheduler.service
master脚本

 

技术分享图片
 1 #!/bin/bash
 2 export RED=\E[1;31m
 3 export RES=\E[0m
 4 export GRN=\E[1;32m
 5 echo -e "${RED} 请确保master已经hosts解析 ${RES}"
 6 echo  -e " ${RED} 开始安装node端  ${RES}"
 7 cat >>/etc/yum.repos.d/virt7-docker-common-release.repo<<EOF
 8 [virt7-docker-common-release]
 9 name=virt7-docker-common-release
10 baseurl=http://cbs.centos.org/repos/virt7-docker-common-release/x86_64/os/
11 gpgcheck=0
12 EOF
13 yum -y install --enablerepo=virt7-docker-common-release kubernetes etcd flannel
14 sed -ri.bak s#(--master=http://)(10.0.0.140)(:8080)#\1master\2#g /etc/kubernetes/config
15 sed -i.bak s#--address=127.0.0.1#--address=0.0.0.0#g  /etc/kubernetes/kubelet
16 sed -i "s#hostname-override=node1#hostname-override=`hostname`#g"  /etc/kubernetes/kubelet
17 systemctl  restart kube-proxy.service  kubelet.service  docker
18 systemctl  enable kube-proxy.service  kubelet.service  docker
node脚本

 

 

 

k8s 1.5.2 安装脚本

标签:技术   bak   脚本   dock   bind   else   int   分享图片   rest   

原文地址:https://www.cnblogs.com/zhangb8042/p/8462728.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!