版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
在CentOS7上使用kubeadm搭建k8s-v1.13.5集群系统初始化设置永久主机名称hostnamectlset-hostnamem01hostnamectlset-hostnames01hostnamectlset-hostnames02添加主机名和IP的对应关系cat>>/etc/hosts<<EOFm01m0s01s0s02s02EOFm01节点免密码ssh登录其他节点ssh-keygen-trsassh-copy-idroot@m01ssh-copy-idroot@s01ssh-copy-idroot@s02注意:遇到即使root用户也无法修改.ssh里相关文件的解决方法使用chattr和lsattr指令修改文件属性,然后就可以调整文件权限了关闭每台机器上的防火墙systemctlstopfirewalldsystemctldisablefirewalldiptables-F&&iptables-X&&iptables-F-tnat&&iptables-X-tnatiptables-PFORWARDACCEPT关闭swap分区swapoff-ased-i'/swap/s/^\(.*\)$/#\1/g'/etc/fstab设置时区#调整系统TimeZonetimedatectlset-timezoneAsia/Shanghai#将当前的UTC时间写入硬件时钟timedatectlset-local-rtc0#重启依赖于系统时间的服务systemctlrestartrsyslogsystemctlrestartcrond[root@m01~]#timedatectlset-timezoneAsia/Shanghai[root@m01~]#timedatectlset-local-rtc0[root@m01~]#更新系统时间ntpdate[root@m01~]#ntpdate19Apr14:31:13ntpdate[16848]:theNTPsocketisinuse,exiting[root@m01~]#installdocker卸载旧版docker并手动删除/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.关闭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~]#开启CentOS网桥[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~]#准备k8s的国内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列出安装过的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. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 二零二五版校园绿化项目生态监测与合同4篇
- 二零二四年度上海市消防设施维护保养与应急预案演练合同3篇
- 二零二五版离婚协议中关于离婚后个人情感寄托的单方协议3篇
- 正手击高远球 说课稿-2023-2024学年高二上学期体育与健康人教版必修第一册
- 《第7课 搜索文件》说课稿教学反思-2023-2024学年小学信息技术人教版三起三年级下册
- 2025年度瓷砖电商平台知识产权保护合同4篇
- Unit 10 Wind Period 1 (说课稿)-2024-2025学年沪教牛津版深圳用英语五年级上册
- 二零二五年度二人合资开设艺术画廊合作协议书2篇
- 个性化知识产权服务协议2024版要点版B版
- 二零二五年度生态园林景观提升工程合同4篇
- 2024年黑河嫩江市招聘社区工作者考试真题
- 第22单元(二次函数)-单元测试卷(2)-2024-2025学年数学人教版九年级上册(含答案解析)
- 蓝色3D风工作总结汇报模板
- 安全常识课件
- 河北省石家庄市2023-2024学年高一上学期期末联考化学试题(含答案)
- 2024年江苏省导游服务技能大赛理论考试题库(含答案)
- 2024年中考英语阅读理解表格型解题技巧讲解(含练习题及答案)
- 新版中国食物成分表
- 浙江省温州市温州中学2025届数学高二上期末综合测试试题含解析
- 2024年山东省青岛市中考生物试题(含答案)
- 保安公司市场拓展方案-保安拓展工作方案
评论
0/150
提交评论