91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

二進制部署K8s集群

發布時間:2020-07-28 23:48:16 來源:網絡 閱讀:471 作者:羊皮裘老頭 欄目:云計算

二進制部署K8s集群

配置nfs服務端

NFS_SERVER(){
yum install -y nfs-utils rpcbind
mkdir -pv /nfs
systemctl restart nfs rpcbind
systemctl enable nfs rpcbind
echo '/nfs  *(rw,no_root_squash)' > /etc/exports
exportfs -rav
cd /nfs
}

1、nfs共享之客戶端

NFS_CLIENT(){
yum install -y nfs-utils rpcbind
systemctl restart nfs rpcbind
systemctl enable nfs rpcbind
mkdir -pv /nfs
showmount -e 192.168.11.11
mount.nfs 192.168.11.11:/nfs  /nfs
df -hT
}

2、主機名設置

HOST_NAME(){
read -p 'please inpute hostname(eg.srv11):' NAME
HOSTNAME=${NAME}
hostnamectl --static set-hostname $HOSTNAME
hostname
#修改hosts文件
grep -E 'node|srv|dk.io' /etc/hosts || echo '
192.168.11.11   node1  k8s-master  srv11
192.168.11.12   node2  k8s-node1   srv12
192.168.11.13   node3  k8s-node2   srv13
192.168.11.14   node4  k8s-node3   srv14
192.168.11.11   dk.io
' >> /etc/hosts
cat /etc/hosts
}

3、etcd、flannel安裝配置

ETCD_INST(){
\cp -fv /nfs/k8s/k8s.repo /etc/yum.repos.d/
yum install -y etcd flannel
[ -f /etc/etcd/etcd.conf.bak ] || cp -v /etc/etcd/etcd.conf{,.bak}
cd /etc/etcd
#去掉第5、20、26、27、28行首的#號
sed -i 's/localhost/0.0.0.0/' etcd.conf
sed -i '5s/^#//;20s/^#//;26s/^#//;27s/^#//;28s/^#//;' etcd.conf
egrep -nv '^#|^$' etcd.conf

sed -i "9,26s/default/${HOSTNAME}/;" etcd.conf
sed -i "20,21s/0.0.0.0/${HOSTNAME}/;" etcd.conf
egrep -nv '^#|^$' etcd.conf

Cluster='ETCD_INITIAL_CLUSTER="srv11=http://srv11:2380,srv12=http://srv12:2380,srv13=http://srv13:2380"'
sed -i "26c ${Cluster}" etcd.conf
egrep -nv '^#|^$' etcd.conf

sed -i '4s/127.0.0.1/srv11/' /etc/sysconfig/flanneld
cat /etc/sysconfig/flanneld

4、啟動etcd服務

systemctl enable etcd
systemctl restart etcd
etcdctl get /atomic.io/network/config
[ $? -eq 0 ] || etcdctl mk /atomic.io/network/config '{ "Network": "10.0.0.0/16" }'
systemctl enable flanneld
systemctl restart flanneld
}

5、安裝k8s-master服務器

K8S_MASTER(){
yum install -y docker kubernetes
systemctl restart docker
systemctl enable docker
docker info

6、apiserver、config文件修改腳本

cd /etc/kubernetes/
sed -i '11s/^# //;14s/^# //' apiserver
sed -i '8s/127.0.0.1/0.0.0.0/' apiserver
sed -i "17s/127.0.0.1/${HOSTNAME}/" apiserver
sed -i "23s/SecurityContextDeny,ServiceAccount,//" apiserver
grep -Ev '^$|^#' apiserver
cd /etc/kubernetes/
sed -i "22s/127.0.0.1/srv11/" config
grep -Ev '^$|^#' config

7、k8s-master啟動服務并設置開機自啟動

systemctl enable docker.service
systemctl restart docker.service
systemctl enable kube-apiserver.service
systemctl restart kube-apiserver.service
systemctl enable kube-controller-manager.service
systemctl restart kube-controller-manager.service
systemctl enable kube-scheduler.service
systemctl restart kube-scheduler.service
kubectl get nodes

8、訪問http://kube-apiserver:port,查看所有請求url和創建狀態

curl http://192.168.11.11:8080 
curl http://192.168.11.11:8080/healthz/ping
}

9、k8s-node節點部署
#安裝docker和kubernets(參考k8s-master的安裝方法)

K8S_NODE(){
yum install -y docker kubernetes
systemctl restart docker
systemctl enable docker
docker info

10、config、kubelet文件修改腳本

cd /etc/kubernetes/
MASTER='srv11'
sed -i "22s/127.0.0.1/${MASTER}/" config
grep -Ev '^$|^#' config

cd /etc/kubernetes/
sed -i "5s/127.0.0.1/0.0.0.0/" kubelet
sed -i '8s/^# //' kubelet
sed -i "11s/127.0.0.1/${HOSTNAME}/" kubelet
sed -i "14s/127.0.0.1/srv11/" kubelet
grep -Ev '^$|^#' kubelet

11、k8s-node1啟動服務并設置開機自啟動

systemctl enable docker.service
systemctl restart docker.service
systemctl enable kubelet.service
systemctl restart kubelet.service
systemctl enable kube-proxy.service
systemctl restart kube-proxy.service
kubectl -s http://srv11:8080 get nodes
}

12、k8s集群狀態檢測

K8S_STAT(){
etcdctl member list
etcdctl cluster-health
kubectl -s http://srv11:8080 get node 
}

cat <<-EOF
---K8S_Cluster_install--
1.k8s-master install
2.k8s-node install
3.k8s-status query
EOF
read -p 'please input choice:' I
case $I in
1)
    NFS_SERVER
    read -p 'press enter to continue.'
    HOST_NAME
    ETCD_INST
    read -p 'press enter to continue.'
    K8S_MASTER

;;
2)
    NFS_CLIENT
    read -p 'press enter to continue.'
    HOST_NAME
    ETCD_INST
    read -p 'press enter to continue.'
    K8S_NODE
;;

3)
    K8S_STAT
;;
*)
    echo 'input error choice.'
    exit 127
;;
esac
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

久治县| 长汀县| 石首市| 佛坪县| 浦北县| 长泰县| 五原县| 大渡口区| 扬州市| 钟祥市| 巨鹿县| 阆中市| 晋城| 平和县| 济源市| 吐鲁番市| 芮城县| 色达县| 盐源县| 梅州市| 绵竹市| 监利县| 成武县| 新蔡县| 新乡县| 土默特左旗| 望奎县| 区。| 丹棱县| 弋阳县| 赤峰市| 崇信县| 麻城市| 武乡县| 荥经县| 临清市| 中宁县| 北安市| 岚皋县| 慈溪市| 当阳市|