本篇文章為大家展示了Kubernetes模擬生產(chǎn)環(huán)境搭建高可用集群中的環(huán)境規(guī)劃和基礎(chǔ)準(zhǔn)備是怎樣的,內(nèi)容簡(jiǎn)明扼要并且容易理解,絕對(duì)能使你眼前一亮,通過(guò)這篇文章的詳細(xì)介紹希望你能有所收獲。
成都創(chuàng)新互聯(lián)是一家專業(yè)的成都網(wǎng)站建設(shè)公司,我們專注成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作、網(wǎng)絡(luò)營(yíng)銷、企業(yè)網(wǎng)站建設(shè),友情鏈接,廣告投放平臺(tái)為企業(yè)客戶提供一站式建站解決方案,能帶給客戶新的互聯(lián)網(wǎng)理念。從網(wǎng)站結(jié)構(gòu)的規(guī)劃UI設(shè)計(jì)到用戶體驗(yàn)提高,創(chuàng)新互聯(lián)力求做到盡善盡美。
一、模擬環(huán)境機(jī)器規(guī)劃
二、集群環(huán)境說(shuō)明
操作系統(tǒng):CentOS7.7
Kubernetes版本:1.16.2
Docker版本:19.03
三、集群主控和工作節(jié)點(diǎn)基礎(chǔ)準(zhǔn)備
1..配置hosts文件
sudo cat >> /etc/hosts<<EOF
192.168.100.111 kube_cluster_master01
192.168.100.112 kube_cluster_master02
192.168.100.113 kube_cluster_master03
192.168.100.114 kube_cluster_minion01
192.168.100.115 kube_cluster_minion02
192.168.100.116 kube_cluster_minion03
192.168.100.117 kube_cluster_minion04
192.168.100.118 kube_cluster_minion05
EOF
2.修改hostname文件
sudo hostnamectl set-hostname <newhostname>
修改完成logout或者重啟啟動(dòng)就可看到修改結(jié)果
3.關(guān)閉系統(tǒng)防火墻
sudo systemctl stop firewalld && systemctl disable firewalld
4.禁用swap內(nèi)存交換
sudo swapoff -a && sudo echo "swapoff -a" >>/etc/rc.d/rc.local && sudo chmod +x /etc/rc.d/rc.local
5.關(guān)閉系統(tǒng)selinux
sudo setenforce 0
sudo sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
sudo sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
6.修改系統(tǒng)內(nèi)核參數(shù)
sudo cat > /etc/sysctl.d/k8s.conf << EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.ipv4.ip_local_port_range = 10000 65000
fs.file-max = 2000000
EOF
sudo sysctl --system
7.校對(duì)系統(tǒng)時(shí)間
搭建內(nèi)網(wǎng)時(shí)間校正服務(wù)器,本文將時(shí)間服務(wù)器部署于192.168.100.101上,搭建服務(wù)步驟:
下載ntp-dev-4.3.99.tar.gz二進(jìn)制包,解壓:tar -zxvf ntp-dev-4.3.99.tar.gz
進(jìn)入解壓目錄執(zhí)行 ./configure
然后執(zhí)行編譯安裝 make && make install
sudo vi /etc/ntp.conf 修改配置文件,如下:
# For more information about this file, see the man pages # ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5). driftfile /var/lib/ntp/drift restrict default nomodify restrict 127.0.0.1 restrict ::1 restrict 192.168.100.0 mask 255.255.254.0 nomodify server ntp1.aliyun.com server ntp2.aliyun.com server ntp3.aliyun.com server 127.127.1.0 fudge 127.127.1.0 stratum 8 logfile /var/lib/ntp/ntp.log disable monitor
mkdir /var/lib/ntp
touch /var/lib/ntp/ntp.log
sudo vi /usr/lib/systemd/system/ntpd.service 如下:編寫(xiě)ntp服務(wù)配置文件,如下:
[Unit] Description=ntpd After=syslog.target [Service] Type=forking ExecStart=/usr/local/bin/ntpd -c /etc/ntpd.conf -p /var/run/ntpd.pid -g PrivateTmp=true [Install] WantedBy=multi-user.target
使用iptables -F暫停防火墻,然后啟動(dòng)ntp服務(wù)systemctl enable ntpd && systemctl start ntpd
集群中的機(jī)器將101服務(wù)器上的/usr/local/bin/ntpdate文件拷貝到自己對(duì)應(yīng)的目錄下
集群中的機(jī)器都使用ntpdate -d 192.168.100.101同步時(shí)間,然后將同步的系統(tǒng)時(shí)間寫(xiě)入biso,如下:
其他方案:使用終端同時(shí)給個(gè)機(jī)器設(shè)置時(shí)間:date -s "2019-11-03 22:18:00" (修改成當(dāng)期時(shí)間),使用clock -w把系統(tǒng)時(shí)間寫(xiě)入CMOS,使用hwclock -w將系統(tǒng)時(shí)間寫(xiě)入BISO
四、集群搭建所需安裝包
ntp:http://www.ntp.org/downloads.html
kubernetes:https://github.com/kubernetes/kubernetes/releases
docker:https://download.docker.com
docker-compose:https://github.com/docker/compose/releases
上述內(nèi)容就是Kubernetes模擬生產(chǎn)環(huán)境搭建高可用集群中的環(huán)境規(guī)劃和基礎(chǔ)準(zhǔn)備是怎樣的,你們學(xué)到知識(shí)或技能了嗎?如果還想學(xué)到更多技能或者豐富自己的知識(shí)儲(chǔ)備,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。
當(dāng)前標(biāo)題:Kubernetes模擬生產(chǎn)環(huán)境搭建高可用集群中的環(huán)境規(guī)劃和基礎(chǔ)準(zhǔn)備是怎樣的
文章地址:http://jinyejixie.com/article36/podepg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供小程序開(kāi)發(fā)、微信小程序、響應(yīng)式網(wǎng)站、網(wǎng)站策劃、靜態(tài)網(wǎng)站、服務(wù)器托管
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)