版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
在CentOS7上使用kubeadm搭建k8s-v1.13.5集群系統(tǒng)初始化設(shè)置永久主機(jī)名稱(chēng)hostnamectlset-hostnamem01hostnamectlset-hostnames01hostnamectlset-hostnames02添加主機(jī)名和IP的對(duì)應(yīng)關(guān)系cat>>/etc/hosts<<EOFm01m0s01s0s02s02EOFm01節(jié)點(diǎn)免密碼ssh登錄其他節(jié)點(diǎn)ssh-keygen-trsassh-copy-idroot@m01ssh-copy-idroot@s01ssh-copy-idroot@s02注意:遇到即使root用戶(hù)也無(wú)法修改.ssh里相關(guān)文件的解決方法使用chattr和lsattr指令修改文件屬性,然后就可以調(diào)整文件權(quán)限了關(guān)閉每臺(tái)機(jī)器上的防火墻systemctlstopfirewalldsystemctldisablefirewalldiptables-F&&iptables-X&&iptables-F-tnat&&iptables-X-tnatiptables-PFORWARDACCEPT關(guān)閉swap分區(qū)swapoff-ased-i'/swap/s/^\(.*\)$/#\1/g'/etc/fstab設(shè)置時(shí)區(qū)#調(diào)整系統(tǒng)TimeZonetimedatectlset-timezoneAsia/Shanghai#將當(dāng)前的UTC時(shí)間寫(xiě)入硬件時(shí)鐘timedatectlset-local-rtc0#重啟依賴(lài)于系統(tǒng)時(shí)間的服務(wù)systemctlrestartrsyslogsystemctlrestartcrond[root@m01~]#timedatectlset-timezoneAsia/Shanghai[root@m01~]#timedatectlset-local-rtc0[root@m01~]#更新系統(tǒng)時(shí)間ntpdate[root@m01~]#ntpdate19Apr14:31:13ntpdate[16848]:theNTPsocketisinuse,exiting[root@m01~]#installdocker卸載舊版docker并手動(dòng)刪除/var/lib/docker目錄[root@m01~]#sudoyumremovedocker\>docker-client\>docker-client-latest\>docker-common\>docker-latest\>docker-latest-logrotate\>docker-logrotate\>docker-selinux\>docker-engine-selinux\>docker-engineLoadedplugins:fastestmirror,langpacksNoMatchforargument:dockerNoMatchforargument:docker-clientNoMatchforargument:docker-client-latestNoMatchforargument:docker-commonNoMatchforargument:docker-latestNoMatchforargument:docker-latest-logrotateNoMatchforargument:docker-logrotateNoMatchforargument:docker-selinuxNoMatchforargument:docker-engine-selinuxNoMatchforargument:docker-engineNoPackagesmarkedforremoval[root@m01~]#[root@m01~]#rm-rf/var/lib/docker/[root@m01~]#setupdockerrepository.Installrequiredpackages.
yum-utils
providesthe
yum-config-managerutility,and
device-mapper-persistent-data
and
lvm2
arerequiredbythe
devicemapper
storagedriver.$sudoyuminstall-yyum-utils\device-mapper-persistent-data\lvm.Usethefollowingcommandtosetupthe
stable
repository.$sudoyum-config-manager\--add-repo\/linux/centos/docker-ce.repo安裝docker[root@s02~]#sudoyuminstall-ydocker-cedocker-ce-clicontainerd.ioLoadedplugins:fastestmirror,langpacksLoadingmirrorspeedsfromcachedhostfilePackage1:docker-ce-cli-18.09.5-3.el7.x86_64alreadyinstalledandlatestversionPackagecontainerd.io-1.2.5-3.1.el7.x86_64alreadyinstalledandlatestversionResolvingDependencies-->Runningtransactioncheck--->Packagedocker-ce.x86_643:18.09.5-3.el7willbeinstalled-->ProcessingDependency:container-selinux>=2.9forpackage:3:docker-ce-18.09.5-3.el7.x86_64-->Runningtransactioncheck--->Packagecontainer-selinux.noarch2:2.74-1.el7willbeinstalled-->FinishedDependencyResolutionDependenciesResolved=================================================================================================================================================================================PackageArchVersionRepositorySize=================================================================================================================================================================================Installing:docker-cex86_643:18.09.5-3.el7docker-ce-stable19MInstallingfordependencies:container-selinuxnoarch2:2.74-1.el7extras38kTransactionSummary=================================================================================================================================================================================Install1Package(+1Dependentpackage)Totalsize:19MTotaldownloadsize:19MInstalledsize:81MDownloadingpackages:DeltaRPMsdisabledbecause/usr/bin/applydeltarpmnotinstalled.docker-ce-18.09.5-3.el7.x86_64.rpm|19MB00:00:04RunningtransactioncheckRunningtransactiontestTransactiontestsucceededRunningtransactionInstalling:2:container-selinux-2.74-1.el7.noarch1/2setsebool:SELinuxisdisabled.Installing:3:docker-ce-18.09.5-3.el7.x86_642/2Verifying:2:container-selinux-2.74-1.el7.noarch1/2Verifying:3:docker-ce-18.09.5-3.el7.x86_642/2Installed:docker-ce.x86_643:18.09.5-3.el7DependencyInstalled:container-selinux.noarch2:2.74-1.el7Complete![root@s02~]#sudosystemctlstartdocker[root@s02~]#sudosystemctlenabledockerCreatedsymlinkfrom/etc/systemd/system/multi-user.target.wants/docker.serviceto/usr/lib/systemd/system/docker.service.[root@s02~]#sudodockerrunhello-worldUnabletofindimage'hello-world:latest'locallylatest:Pullingfromlibrary/hello-world1b930d010525:PullcompleteDigest:sha256:92695bc579f31df7a63da6922075d0666e565ceccad16b59c3374d2cf4e8e50eStatus:Downloadednewerimageforhello-world:latestHellofromDocker!Thismessageshowsthatyourinstallationappearstobeworkingcorrectly.Togeneratethismessage,Dockertookthefollowingsteps:1.TheDockerclientcontactedtheDockerdaemon.2.TheDockerdaemonpulledthe"hello-world"imagefromtheDockerHub.(amd64)3.TheDockerdaemoncreatedanewcontainerfromthatimagewhichrunstheexecutablethatproducestheoutputyouarecurrentlyreading.4.TheDockerdaemonstreamedthatoutputtotheDockerclient,whichsentittoyourterminal.Totrysomethingmoreambitious,youcanrunanUbuntucontainerwith:$dockerrun-itubuntubashShareimages,automateworkflows,andmorewithafreeDockerID:/Formoreexamplesandideas,visit:/get-started/[root@s02~]#installingkubeadm前置要求2GBormoreofRAMpermachine(anylesswillleavelittleroomforyourapps)2CPUsormoreFullnetworkconnectivitybetweenallmachinesinthecluster(publicorprivatenetworkisfine)Uniquehostname,MACaddress,andproduct_uuidforeverynode.Seehereformoredetails.Certainportsareopenonyourmachines.Seehereformoredetails.Swapdisabled.YouMUSTdisableswapinorderforthekubelettoworkproperly.檢查要求的端口Masternode(s)ProtocolDirectionPortRangePurposeUsedByTCPInbound6443*KubernetesAPIserverAllTCPInbound2379-2380etcdserverclientAPIkube-apiserver,etcdTCPInbound10250KubeletAPISelf,ControlplaneTCPInbound10251kube-schedulerSelfTCPInbound10252kube-controller-managerSelfWorkernode(s)ProtocolDirectionPortRangePurposeUsedByTCPInbound10250KubeletAPISelf,ControlplaneTCPInbound30000-32767NodePortServices**All**DefaultportrangeforNodePortServices.Anyportnumbersmarkedwith*areoverridable,soyouwillneedtoensureanycustomportsyouprovidearealsoopen.Althoughetcdportsareincludedinmasternodes,youcanalsohostyourownetcdclusterexternallyoroncustomports.Thepodnetworkpluginyouuse(seebelow)mayalsorequirecertainportstobeopen.Sincethisdifferswitheachpodnetworkplugin,pleaseseethedocumentationforthepluginsaboutwhatport(s)thoseneed.關(guān)閉SELinux[root@redis-test2~]#clear[root@redis-test2~]#setenforce0setenforce:SELinuxisdisabled[root@redis-test2~]#sed-i's/^SELINUX=enforcing$/SELINUX=permissive/'/etc/selinux/config[root@redis-test2~]#開(kāi)啟CentOS網(wǎng)橋[root@redis-test2~]#cat<<EOF>/etc/sysctl.d/k8s.conf>net.bridge.bridge-nf-call-ip6tables=1>net.bridge.bridge-nf-call-iptables=1>EOF[root@redis-test2~]#sysctl--system*Applying/usr/lib/sysctl.d/00-system.conf...net.bridge.bridge-nf-call-ip6tables=0net.bridge.bridge-nf-call-iptables=0net.bridge.bridge-nf-call-arptables=0*Applying/usr/lib/sysctl.d/10-default-yama-scope.conf...kernel.yama.ptrace_scope=0*Applying/usr/lib/sysctl.d/50-default.conf...kernel.sysrq=16kernel.core_uses_pid=1net.ipv4.conf.default.rp_filter=1net.ipv4.conf.all.rp_filter=1net.ipv4.conf.default.accept_source_route=0net.ipv4.conf.all.accept_source_route=0mote_secondaries=1mote_secondaries=1tected_hardlinks=1tected_symlinks=1*Applying/etc/sysctl.d/99-sysctl.conf...*Applying/etc/sysctl.d/k8s.conf...net.bridge.bridge-nf-call-ip6tables=1net.bridge.bridge-nf-call-iptables=1*Applying/etc/sysctl.conf...[root@redis-test2~]#準(zhǔn)備k8s的國(guó)內(nèi)yum源[root@redis-test2~]#cat<<EOF>/etc/yum.repos.d/kubernetes.repo>[kubernetes]>name=Kubernetes>baseurl=/kubernetes/yum/repos/kubernetes-el7-x86_64>enabled=1>gpgcheck=0>EOF[root@redis-test2~]#cat/etc/yum.repos.d/kubernetes.repo[kubernetes]name=Kubernetesbaseurl=/kubernetes/yum/repos/kubernetes-el7-x86_64enabled=1gpgcheck=0[root@redis-test2~]#安裝v1.13.5版本的kubeletkubeadmkubectl列出安裝過(guò)的rpm包[root@redis-test1~]#yumlistinstalled|grepkubecri-tools.x86_641.12.0-0@kuberneteskubeadm.x86_641.14.1-0@kuberneteskubectl.x86_641.14.1-0@kuberneteskubelet.x86_641.14.1-0@kuberneteskubernetes-cni.x86_640.7.5-0@kubernetes[root@redis-test1~]#卸載安裝的rpm包[root@redis-test1~]#yumremovekubeadm.x86_64kubectl.x86_64kubelet.x86_64kubernetes-cni.x86_64Loadedplugins:fastestmirror,langpacksResolvingDependencies-->Runningtransactioncheck--->Packagekubeadm.x86_640:1.14.1-0willbeerased--->Packagekubectl.x86_640:1.14.1-0willbeerased--->Packagekubelet.x86_640:1.14.1-0willbeerased--->Packagekubernetes-cni.x86_640:0.7.5-0willbeerased-->FinishedDependencyResolutionDependenciesResolved=================================================================================================================================================================================PackageArchVersionRepositorySize=================================================================================================================================================================================Removing:kubeadmx86_641.14.1-0@kubernetes38Mkubectlx86_641.14.1-0@kubernetes41Mkubeletx86_641.14.1-0@kubernetes122Mkubernetes-cnix86_640.7.5-0@kubernetes35MTransactionSummary=================================================================================================================================================================================Remove4PackagesInstalledsize:236MIsthisok[y/N]:yDownloadingpackages:RunningtransactioncheckRunningtransactiontestTransactiontestsucceededRunningtransactionErasing:kubeadm-1.14.1-0.x86_641/4Erasing:kubelet-1.14.1-0.x86_642/4Erasing:kubernetes-cni-0.7.5-0.x86_643/4Erasing:kubectl-1.14.1-0.x86_644/4Verifying:kubeadm-1.14.1-0.x86_641/4Verifying:kubernetes-cni-0.7.5-0.x86_642/4Verifying:kubelet-1.14.1-0.x86_643/4Verifying:kubectl-1.14.1-0.x86_644/4Removed:kubeadm.x86_640:1.14.1-0kubectl.x86_640:1.14.1-0kubelet.x86_640:1.14.1-0kubernetes-cni.x86_640:0.7.5-0Complete![root@redis-test1~]#.安裝指定版本的kubeadm.1.查看可得kubelet版本[root@redis-test3~]#yumlistkubelet--showduplicates|sort-rLoadingmirrorspeedsfromcachedhostfileLoadedplugins:fastestmirror,langpackskubelet.x86_641.9.9-0kuberneteskubelet.x86_641.9.8-0kuberneteskubelet.x86_641.9.7-0kuberneteskubelet.x86_641.9.6-0kuberneteskubelet.x86_641.9.5-0kuberneteskubelet.x86_641.9.4-0kuberneteskubelet.x86_641.9.3-0kuberneteskubelet.x86_641.9.2-0kuberneteskubelet.x86_641.9.11-0kuberneteskubelet.x86_641.9.1-0kuberneteskubelet.x86_641.9.10-0kuberneteskubelet.x86_641.9.0-0kuberneteskubelet.x86_641.8.9-0kuberneteskubelet.x86_641.8.8-0kuberneteskubelet.x86_641.8.7-0kuberneteskubelet.x86_641.8.6-0kuberneteskubelet.x86_641.8.5-1kuberneteskubelet.x86_641.8.5-0kuberneteskubelet.x86_641.8.4-1kuberneteskubelet.x86_641.8.4-0kuberneteskubelet.x86_641.8.3-1kuberneteskubelet.x86_641.8.3-0kuberneteskubelet.x86_641.8.2-1kuberneteskubelet.x86_641.8.2-0kuberneteskubelet.x86_641.8.15-0kuberneteskubelet.x86_641.8.14-0kuberneteskubelet.x86_641.8.13-0kuberneteskubelet.x86_641.8.12-0kuberneteskubelet.x86_641.8.1-1kuberneteskubelet.x86_641.8.11-0kuberneteskubelet.x86_641.8.1-0kuberneteskubelet.x86_641.8.10-0kuberneteskubelet.x86_641.8.0-1kuberneteskubelet.x86_641.8.0-0kuberneteskubelet.x86_641.7.9-1kuberneteskubelet.x86_641.7.9-0kuberneteskubelet.x86_641.7.8-2kuberneteskubelet.x86_641.7.8-1kuberneteskubelet.x86_641.7.7-2kuberneteskubelet.x86_641.7.7-1kuberneteskubelet.x86_641.7.6-2kuberneteskubelet.x86_641.7.6-1kuberneteskubelet.x86_641.7.5-1kuberneteskubelet.x86_641.7.5-0kuberneteskubelet.x86_641.7.4-1kuberneteskubelet.x86_641.7.4-0kuberneteskubelet.x86_641.7.3-2kuberneteskubelet.x86_641.7.3-1kuberneteskubelet.x86_641.7.2-1kuberneteskubelet.x86_641.7.2-0kuberneteskubelet.x86_641.7.16-0kuberneteskubelet.x86_641.7.15-0kuberneteskubelet.x86_641.7.14-0kuberneteskubelet.x86_641.7.1-1kuberneteskubelet.x86_641.7.11-1kuberneteskubelet.x86_641.7.11-0kuberneteskubelet.x86_641.7.1-0kuberneteskubelet.x86_641.7.10-1kuberneteskubelet.x86_641.7.10-0kuberneteskubelet.x86_641.7.0-1kuberneteskubelet.x86_641.7.0-0kuberneteskubelet.x86_641.6.9-1kuberneteskubelet.x86_641.6.9-0kuberneteskubelet.x86_641.6.8-1kuberneteskubelet.x86_641.6.8-0kuberneteskubelet.x86_641.6.7-1kuberneteskubelet.x86_641.6.7-0kuberneteskubelet.x86_641.6.6-1kuberneteskubelet.x86_641.6.6-0kuberneteskubelet.x86_641.6.5-1kuberneteskubelet.x86_641.6.5-0kuberneteskubelet.x86_641.6.4-1kuberneteskubelet.x86_641.6.4-0kuberneteskubelet.x86_641.6.3-1kuberneteskubelet.x86_641.6.3-0kuberneteskubelet.x86_641.6.2-1kuberneteskubelet.x86_641.6.2-0kuberneteskubelet.x86_641.6.13-1kuberneteskubelet.x86_641.6.13-0kuberneteskubelet.x86_641.6.12-1kuberneteskubelet.x86_641.6.12-0kuberneteskubelet.x86_641.6.1-1kuberneteskubelet.x86_641.6.11-1kuberneteskubelet.x86_641.6.11-0kuberneteskubelet.x86_641.6.1-0kuberneteskubelet.x86_641.6.10-1kuberneteskubelet.x86_641.6.10-0kuberneteskubelet.x86_641.6.0-1kuberneteskubelet.x86_641.6.0-0kuberneteskubelet.x86_641.5.4-1kuberneteskubelet.x86_641.5.4-0kuberneteskubelet.x86_641.14.1-0kuberneteskubelet.x86_641.14.0-0kuberneteskubelet.x86_641.13.5-0kuberneteskubelet.x86_641.13.4-0kuberneteskubelet.x86_641.13.3-0kuberneteskubelet.x86_641.13.2-0kuberneteskubelet.x86_641.13.1-0kuberneteskubelet.x86_641.13.0-0kuberneteskubelet.x86_641.12.7-0kuberneteskubelet.x86_641.12.6-0kuberneteskubelet.x86_641.12.5-0kuberneteskubelet.x86_641.12.4-0kuberneteskubelet.x86_641.12.3-0kuberneteskubelet.x86_641.12.2-0kuberneteskubelet.x86_641.12.1-0kuberneteskubelet.x86_641.12.0-0kuberneteskubelet.x86_641.11.9-0kuberneteskubelet.x86_641.11.8-0kuberneteskubelet.x86_641.11.7-0kuberneteskubelet.x86_641.11.6-0kuberneteskubelet.x86_641.11.5-0kuberneteskubelet.x86_641.11.4-0kuberneteskubelet.x86_641.11.3-0kuberneteskubelet.x86_641.11.2-0kuberneteskubelet.x86_641.11.1-0kuberneteskubelet.x86_641.11.0-0kuberneteskubelet.x86_641.10.9-0kuberneteskubelet.x86_641.10.8-0kuberneteskubelet.x86_641.10.7-0kuberneteskubelet.x86_641.10.6-0kuberneteskubelet.x86_641.10.5-0kuberneteskubelet.x86_641.10.4-0kuberneteskubelet.x86_641.10.3-0kuberneteskubelet.x86_641.10.2-0kuberneteskubelet.x86_641.10.13-0kuberneteskubelet.x86_641.10.12-0kuberneteskubelet.x86_641.10.11-0kuberneteskubelet.x86_641.10.1-0kuberneteskubelet.x86_641.10.10-0kuberneteskubelet.x86_641.10.0-0kubernetesAvailablePackages[root@redis-test3~]#.2.查看可得的kubeadm版本[root@redis-test3~]#yumlistkubeadm--showduplicates|sort-rLoadingmirrorspeedsfromcachedhostfileLoadedplugins:fastestmirror,langpackskubeadm.x86_641.9.9-0kuberneteskubeadm.x86_641.9.8-0kuberneteskubeadm.x86_641.9.7-0kuberneteskubeadm.x86_641.9.6-0kuberneteskubeadm.x86_641.9.5-0kuberneteskubeadm.x86_641.9.4-0kuberneteskubeadm.x86_641.9.3-0kuberneteskubeadm.x86_641.9.2-0kuberneteskubeadm.x86_641.9.11-0kuberneteskubeadm.x86_641.9.1-0kuberneteskubeadm.x86_641.9.10-0kuberneteskubeadm.x86_641.9.0-0kuberneteskubeadm.x86_641.8.9-0kuberneteskubeadm.x86_641.8.8-0kuberneteskubeadm.x86_641.8.7-0kuberneteskubeadm.x86_641.8.6-0kuberneteskubeadm.x86_641.8.5-0kuberneteskubeadm.x86_641.8.4-0kuberneteskubeadm.x86_641.8.3-0kuberneteskubeadm.x86_641.8.2-0kuberneteskubeadm.x86_641.8.15-0kuberneteskubeadm.x86_641.8.14-0kuberneteskubeadm.x86_641.8.13-0kuberneteskubeadm.x86_641.8.12-0kuberneteskubeadm.x86_641.8.11-0kuberneteskubeadm.x86_641.8.
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 《會(huì)計(jì)從業(yè)總賬管理》課件
- 《廣場(chǎng)規(guī)劃設(shè)計(jì)》課件
- 寒假自習(xí)課 25春初中道德與法治八年級(jí)下冊(cè)教學(xué)課件 第三單元 第六課 第4課時(shí) 國(guó)家監(jiān)察機(jī)關(guān)
- 短信營(yíng)銷(xiāo)合同三篇
- 農(nóng)學(xué)啟示錄模板
- 理發(fā)店前臺(tái)接待總結(jié)
- 兒科護(hù)士的工作心得
- 探索化學(xué)反應(yīng)奧秘
- 收銀員的勞動(dòng)合同三篇
- 營(yíng)銷(xiāo)策略總結(jié)
- (1-6年級(jí))小學(xué)數(shù)學(xué)常用單位換算公式
- 中建安全標(biāo)準(zhǔn)化圖冊(cè)圖集(上下全集)(全電子版)
- 高一物理必修一思維導(dǎo)圖
- 錨索張拉和鎖定記錄表
- 2016年校本課程--------合唱教案1
- 【原創(chuàng)】《圓柱與圓錐》復(fù)習(xí)課教教學(xué)設(shè)計(jì)
- 《中國(guó)藥典》規(guī)定中藥飲片用量
- 國(guó)網(wǎng)合肥供電公司城市新建住宅小區(qū)電力建設(shè)實(shí)施細(xì)則
- 初中物理元件實(shí)物圖及一些常用圖形
- 中小學(xué)生備戰(zhàn)期末迎接期末考試動(dòng)員班會(huì)PPT
- 房測(cè)之友BMF用戶(hù)說(shuō)明書(shū)
評(píng)論
0/150
提交評(píng)論