在阿里云服务器怎么安装部署docker+Kubernetes(K8s)
<div id="navCategory"><h5 class="catalogue">目录</h5><ul class="first_class_ul"><li>前言<ul class="second_class_ul"><li>Docker全面介绍</li><li>Kubernetes(K8s) 全面介绍</li></ul></li><li>安装部署docker+Kubernetes(K8s)过程<ul class="second_class_ul"><li>1.查阅K8S+docker的版本号对应关系</li><li>2.将所需的安装包下载到本地(进行本地化安装)</li><li>3.机器的准备(其中包括机器版本及配置)</li><li>4.环境的准备</li><li>5.K8S的安装及加载K8S镜像</li><li>6.安装kubeadm并创建K8S集群</li><li>7.遇到的坑</li></ul></li></ul></div><p class="maodian"></p><h2>前言</h2><p class="maodian"></p><h3>Docker全面介绍</h3><p>Docker 是一个商业容器化平台和运行时,可帮助开发人员构建、部署和运行容器。它使用客户端-服务器架构,通过单个 API 提供简单的命令和自动化。<br style="color: rgb(25, 27, 31); font-family: -apple-system, BlinkMacSystemFont, " helvetica="" pingfang="" microsoft="" source="" han="" sans="" noto="" cjk="" wenquanyi="" micro="" font-size:="" white-space:="" background-color:=""/>使用 Docker,开发人员可以通过编写 Dockerfile 来创建容器化应用程序,这本质上是构建容器映像的秘诀。然后,Docker 提供了一组工具来构建和管理这些容器映像,使开发人员能够更轻松地以一致且可重复的方式打包和部署应用程序。<br style="color: rgb(25, 27, 31); font-family: -apple-system, BlinkMacSystemFont, " helvetica="" pingfang="" microsoft="" source="" han="" sans="" noto="" cjk="" wenquanyi="" micro="" font-size:="" white-space:="" background-color:=""/>这些容器映像可以在任何支持容器的平台上运行,例如 Kubernetes、Docker Swarm、Mesos 或 HashiCorp Nomad。Docker的平台使开发人员可以更轻松地创建和管理这些容器镜像,从而简化了跨不同环境构建和部署应用程序的过程。</p><p class="maodian"></p><h3>Kubernetes(K8s) 全面介绍</h3><p>Kubernetes,也称为 K8s,是一个著名的开源平台,旨在跨网络资源集群编排容器运行时系统。它可以独立运行,也可以与其他容器化工具(例如 Docker)结合使用。</p><p>Kubernetes 提供了一种实用的解决方案,用于在一台机器上管理一组容器,以减少网络开销并优化资源利用率。例如,一个容器集可以由应用服务器、Redis 缓存和 SQL 数据库组成。相比之下,Docker 容器被设计为每个容器运行一个进程。</p><p>随着容器的激增,组织最终可能会拥有数百甚至数千个容器,这使得运营团队必须自动化容器部署、网络、可扩展性和可用性。这导致了容器编排市场的出现。</p><p>开发人员选择 Kubernetes 是因为它具有广泛的功能、庞大且不断增长的开源支持工具生态系统,以及它支持各种云服务提供商和工作的能力。所有主要公共云提供商,包括 Amazon Web Services (AWS)、Google Cloud、IBM Cloud 和 Microsoft Azure,都提供完全托管的 Kubernetes 服务,这凸显了其在全行业的受欢迎程度。</p><h3 style="margin-top: 1.4em; margin-bottom: 1.4em; color: rgb(25, 27, 31); font-family: -apple-system, BlinkMacSystemFont, " helvetica="" pingfang="" microsoft="" source="" han="" sans="" noto="" cjk="" wenquanyi="" micro="" font-size:="" white-space:="" background-color:="">Docker 和 Kubernetes 之间的区别<br/></h3><p data-pid="S4CltHOx" style="margin-top: 1.4em; margin-bottom: 1.4em; color: rgb(25, 27, 31); font-family: -apple-system, BlinkMacSystemFont, " helvetica="" pingfang="" microsoft="" source="" han="" sans="" noto="" cjk="" wenquanyi="" micro="" font-size:="" white-space:="" background-color:="">Docker 和 Kubernetes 都是容器化生态系统中的关键组件,具有不同的用途。Docker 主要用于创建和执行容器,而 Kubernetes 用于编排和自动化跨主机集群的容器部署、扩展和管理。<br/>Docker 提供了一种简单有效的容器化方法,而 Kubernetes 提供了自动扩展、自我修复和容器部署等高级功能。</p><p class="maodian"></p><h2>安装部署docker+Kubernetes(K8s)过程</h2><p class="maodian"></p><h3>1.查阅K8S+docker的版本号对应关系</h3><p data-lake-id="a4fbabac252642c4545e6ac7935f18e9" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">1.1.打开github;搜索kubernetes项目(github<span style="color: #000000;">地址:</span><span style="color: #000000;">https://github.com/)</span></p><p data-lake-id="5abc36692810afeb4e75d6807300c051" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><span style="color: #000000;">1.2.打开项目中CHANGELOG文件夹,其中就有CHANGELOG-XXX.md版本号文件,如下截图所示:</span></p><p data-lake-id="6908905632d5da7703e4fa55a612adaf" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><span style="color: #000000;"></span></p><p data-lake-id="d631f9650b70ff7bfee7becec91b7caf" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><span style="color: #000000;"><span data-card-type="inline" data-lake-card="image" contenteditable="false" data-card-value="data:%7B%22src%22%3A%22https%3A%2F%2Fucc.alicdn.com%2Fpic%2Fdeveloper-ecology%2Ftxgmigx6hhamq_44be308bae624e8aae1fddb85317af9b.png%22%2C%22originWidth%22%3A1355%2C%22originHeight%22%3A691%2C%22name%22%3A%2220210618214906218.png%22%2C%22size%22%3A122994%2C%22display%22%3A%22inline%22%2C%22align%22%3A%22left%22%2C%22linkTarget%22%3A%22_blank%22%2C%22status%22%3A%22done%22%2C%22style%22%3A%22none%22%2C%22search%22%3A%22%22%2C%22margin%22%3A%7B%22top%22%3Atrue%2C%22bottom%22%3Atrue%7D%2C%22width%22%3A1355%2C%22height%22%3A691%7D" class="lake-card-margin-top lake-card-margin-bottom"><img data-role="image" src="https://zhuji.jb51.net/uploads/allimg/20240202/1-24020214531H55.png" data-raw-src="" class="image lake-drag-image" alt="20210618214906218.png" title="20210618214906218.png" data-height="691px" style="max-width:100%!important;height:auto!important;visibility: visible; width: 1355px;"/></span></span></p><p data-lake-id="29b1bf79030562fee92b37062584015c" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p data-lake-id="9303864436155bba1d65ec7635633da8" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">1.3.打开kubernetes版本号文件,ctrl+f搜索"docker version",便可以查询到所有可用版本号如下截图所示:</p><p data-lake-id="420376b2a5faf031be2dfce65572136d" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p data-lake-id="139c334997ad10405922c86618c5d5b5" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><span data-card-type="inline" data-lake-card="image" contenteditable="false" data-card-value="data:%7B%22src%22%3A%22https%3A%2F%2Fucc.alicdn.com%2Fpic%2Fdeveloper-ecology%2Ftxgmigx6hhamq_e3b789102a404e42882646b014da7eff.png%22%2C%22originWidth%22%3A1248%2C%22originHeight%22%3A645%2C%22name%22%3A%2220210618214942782.png%22%2C%22size%22%3A137241%2C%22display%22%3A%22inline%22%2C%22align%22%3A%22left%22%2C%22linkTarget%22%3A%22_blank%22%2C%22status%22%3A%22done%22%2C%22style%22%3A%22none%22%2C%22search%22%3A%22%22%2C%22margin%22%3A%7B%22top%22%3Atrue%2C%22bottom%22%3Atrue%7D%2C%22width%22%3A1248%2C%22height%22%3A645%7D" class="lake-card-margin-top lake-card-margin-bottom"><img data-role="image" src="https://zhuji.jb51.net/uploads/allimg/20240202/1-24020214531R17.png" data-raw-src="" class="image lake-drag-image" alt="20210618214942782.png" title="20210618214942782.png" data-height="645px" style="max-width:100%!important;height:auto!important;visibility: visible; width: 1248px;"/></span></p><p data-lake-id="388e9d46b09f4fd3a4f4ade72084a8b2" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p class="maodian"></p><h3>2.将所需的安装包下载到本地(进行本地化安装)</h3><p class="maodian"></p><h3>3.机器的准备(其中包括机器版本及配置)</h3><p data-lake-id="4575cea3be3afab18eb4ae8445cb2d02" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">3.1.查看linux机器版本号命令:cat /proc/version</p><p data-lake-id="4cae1dad67a3cde4cf8c3eabcd5436e1" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">我的版本号:Linux version 3.10.0-1062.18.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Tue Mar 17 23:49:17 UTC 2020</p><p data-lake-id="a26ecc652e29b69bbc82504ac87a812c" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">3.2.机器的配置</p><p data-lake-id="e948ee9ebbfa6c276235844e28bb4722" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">cpu:4C 内存:4G 硬盘:32G</p><p data-lake-id="3d63219d24f171308b1ea37d899a19dc" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">查看cpu(逻辑):cat /proc/cpuinfo | grep ‘processor’ | wc -l</p><p data-lake-id="178bae564eb4f5c2ecc6488fb1e3f646" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">查看cpu(物理):cat /proc/cpuinfo | grep ‘physical id’ | sort | uniq | wc -l</p><p data-lake-id="1063e35b17baf60b94152ced67d2bbf7" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">查看内存总数:cat /proc/meminfo | grep MemTotal</p><p data-lake-id="fd25fd79d2a938c7dc70cd93bef22cf7" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">查看硬盘大小:df -h</p><p class="maodian"></p><h3>4.环境的准备</h3><p data-lake-id="dee572998a2c99750cb5acb64ceed417" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">4.1. 设置主机名与时区</p><p data-lake-id="03cb32d4850c9050585ed60c101eb9ae" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">timedatectl set-timezone Asia/Shanghai #都要执行</p><p data-lake-id="6c051a638abab609105e19ee4b9cddfd" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">hostnamectl set-hostname master #194执行</p><p data-lake-id="d2f3a915c0724ebc0f92a80d8bdd7acc" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">hostnamectl set-hostname node1 #195执行</p><p data-lake-id="b8796e074711cb367b9ee216d9c3be24" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">hostnamectl set-hostname node2 #196执行</p><p data-lake-id="912919534c8d212d04cced76b24ea5c8" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p data-lake-id="4dabbc872fe6aa92d6a9c768164fffe9" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">4.2. 添加hosts网络主机配置,三台虚拟机都要设置</p><p data-lake-id="855a5dbe8d9dd78720691ee8d48988c3" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">vim /etc/hosts</p><p data-lake-id="2ea4ea33e4bf8d2414f150e9b00f86dc" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">192.168.10.194 master</p><p data-lake-id="8279f3f6bb5f948741209f913f919b1d" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">192.168.10.195 node1</p><p data-lake-id="591714d7ae00e4bdd10b4b77ca65435a" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">192.168.10.196 node2</p><p data-lake-id="4e30e57d05d60384add78094fa398ea9" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p data-lake-id="8180e084b8a4acc07b12b583997ce685" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">4.3. 关闭防火墙,三台虚拟机都要设置,生产环境跳过这一步</p><p data-lake-id="afd96d095f2892d4d36a4ed76be4d5b1" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g’ /etc/selinux/config</p><p data-lake-id="98156b3e9857cd52e4fb71ef2c7d0a9c" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">setenforce 0</p><p data-lake-id="d9a12ba4a12f6c1b07294a05e124dfd5" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">systemctl disable firewalld</p><p data-lake-id="871de158670457d7c2bc677cd94a2086" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">systemctl stop firewalld</p><p class="maodian"></p><h3>5.K8S的安装及加载K8S镜像</h3><p data-lake-id="02544105f2a7c0bcccbe6b902d9fb73d" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">5.1. 将镜像包上传至服务器每个节点</p><p data-lake-id="f869180f98a4b5a048f35ce206260f40" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">mkdir /usr/local/k8s-install</p><p data-lake-id="17760ba3803a020d5447a2c31339aa8b" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">cd /usr/local/k8s-install</p><p data-lake-id="796c90543053c0bdf21914756c087cb6" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">XFTP上传安装文件</p><p data-lake-id="185869c1c8f70f71dda11b84fde9487e" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p data-lake-id="8415dd5a42da781a8dd11c9f60c0a884" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">5.2. 按每个Centos上安装Docker</p><p data-lake-id="868131f75a40db1a5faa3384e1363f32" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">tar -zxvf docker-ce-18.09.tar.gz</p><p data-lake-id="395d983a37f5e130e1eada3f45d5cf01" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">cd docker</p><p data-lake-id="ce4b6315105940903c34c4df048252ab" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">yum localinstall -y *.rpm</p><p data-lake-id="49cf508808ea1e5921764394bea56bdd" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p data-lake-id="f3489867acebaf3ffc05191b0140830f" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">systemctl start docker</p><p data-lake-id="19d3a9a51b2fe9f56a13c08d3e168267" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">systemctl enable docker</p><p data-lake-id="38ba558f8a4235baaffe3ea44dbb4ce5" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p data-lake-id="a68b020ba6eb29839176d52741aa51a3" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">5.3. 确保从cgroups均在同一个从groupfs</p><p data-lake-id="90fb631df9fa63b94c8b485858ca40f2" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">#cgroups是control groups的简称,它为Linux内核提供了一种任务聚集和划分的机制,通过一组参数集合将一些任务组织成一个或多个子系统。</p><p data-lake-id="bc4e99ef69a1318b90b3e0ec887a28a6" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">#cgroups是实现IaaS虚拟化(kvm、lxc等),PaaS容器沙箱(Docker等)的资源管理控制部分的底层基础。</p><p data-lake-id="90b0fa3fe382536bda9e53088701b623" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">#子系统是根据cgroup对任务的划分功能将任务按照一种指定的属性划分成的一个组,主要用来实现资源的控制。</p><p data-lake-id="67315cfe5a8f7a41ea31f4456bd96d3e" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">#在cgroup中,划分成的任务组以层次结构的形式组织,多个子系统形成一个数据结构中类似多根树的结构。cgroup包含了多个孤立的子系统,每一个子系统代表单一的资源</p><p data-lake-id="3813e8ecde0a7bee30290890cc73b5f4" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p data-lake-id="d693094373470dcad3fed10ecbdb9a6f" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">docker info | grep cgroup</p><p data-lake-id="2322ab82ce20e1e9b40dcc022693f2f0" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p data-lake-id="6dfcf0dc014fe0c90eb99b6e81289e9c" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">如果不是groupfs,执行下列语句</p><p data-lake-id="c48cf41f585a56a52a76ba7e2cb2ed7d" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><div data-card-type="block" data-lake-card="codeblock" contenteditable="false" data-card-value="data:%7B%22mode%22%3A%22plain%22%2C%22code%22%3A%22cat%20%3C%3C%20EOF%20%3E%20%2Fetc%2Fdocker%2Fdaemon.json%5Cn%7B%5Cn%E2%80%9Cexec-opts%E2%80%9D%3A%20%5B%E2%80%9Cnative.cgroupdriver%3Dcgroupfs%E2%80%9D%5D%5Cn%7D%5CnEOF%5Cnsystemctl%20daemon-reload%20%26%26%20systemctl%20restart%20docker%22%2C%22heightLimit%22%3Atrue%2C%22margin%22%3Atrue%2C%22id%22%3A%224qogv%22%7D" id="4qogv" class="lake-card-margin" data-language="plain"><div class="lake-codeblock-content" style="border: 1px solid rgb(232, 232, 232); max-width: 750px; color: rgb(51, 51, 51); margin: 0px; padding: 0px; background: rgb(249, 249, 249);"><div class="CodeMirror-sizer" style="margin: 0px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);"><pre class="cm-s-default" style="margin-top: 14px; margin-bottom: 14px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);">cat < /etc/docker/daemon.json{“exec-opts”: [“native.cgroupdriver=cgroupfs”]}EOFsystemctl daemon-reload && systemctl restart docker</pre></div></div></div><p data-lake-id="aa5bb2a7dddefdc58452d2ff35ffbabf" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p data-lake-id="929722e05d6a10979b08dae9cac803a1" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">5.4. 安装kubeadm</p><p data-lake-id="94b06d5ffd20bd494e28faf3ac81ac24" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">kubeadm是集群部署工具</p><p data-lake-id="ef349274d9b4708bbf995f7caf7e1560" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><div data-card-type="block" data-lake-card="codeblock" contenteditable="false" data-card-value="data:%7B%22mode%22%3A%22plain%22%2C%22code%22%3A%22cd%20%2Fusr%2Flocal%2Fk8s-install%2Fkubernetes-1.14%5Cntar%20-zxvf%20kube114-rpm.tar.gz%5Cncd%20kube114-rpm%5Cnyum%20localinstall%20-y%20*.rpm%22%2C%22heightLimit%22%3Atrue%2C%22margin%22%3Atrue%2C%22id%22%3A%22bXzBx%22%7D" id="bXzBx" class="lake-card-margin" data-language="plain"><div class="lake-codeblock-content" style="border: 1px solid rgb(232, 232, 232); max-width: 750px; color: rgb(51, 51, 51); margin: 0px; padding: 0px; background: rgb(249, 249, 249);"><div class="CodeMirror-sizer" style="margin: 0px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);"><pre class="cm-s-default" style="margin-top: 14px; margin-bottom: 14px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);">cd /usr/local/k8s-install/kubernetes-1.14tar -zxvf kube114-rpm.tar.gzcd kube114-rpmyum localinstall -y *.rpm</pre></div></div></div><p data-lake-id="2e9e79a9b33e962dcab0d5fb73df052a" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p data-lake-id="2b3160fa1d099958d6a1f949885be37e" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">5.5. 关闭交换区</p><p data-lake-id="5111db7fc23fb42a2f34d2d13a495d0e" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><div data-card-type="block" data-lake-card="codeblock" contenteditable="false" data-card-value="data:%7B%22mode%22%3A%22plain%22%2C%22code%22%3A%22swapoff%20-a%5Cnvi%20%2Fetc%2Ffstab%5Cn%23swap%E4%B8%80%E8%A1%8C%E6%B3%A8%E9%87%8A%22%2C%22heightLimit%22%3Atrue%2C%22margin%22%3Atrue%2C%22id%22%3A%22HNbrC%22%7D" id="HNbrC" class="lake-card-margin" data-language="plain"><div class="lake-codeblock-content" style="border: 1px solid rgb(232, 232, 232); max-width: 750px; color: rgb(51, 51, 51); margin: 0px; padding: 0px; background: rgb(249, 249, 249);"><div class="CodeMirror-sizer" style="margin: 0px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);"><pre class="cm-s-default" style="margin-top: 14px; margin-bottom: 14px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);">swapoff -avi /etc/fstab#swap一行注释</pre></div></div></div><p data-lake-id="7335a131066981d537f4a9f04979be2e" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p data-lake-id="0b5627fd5652bf97e50e6e0b3de534d8" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">5.6. 配置网桥</p><p data-lake-id="bf840d545c31e6b38102a0d8b846d319" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><div data-card-type="block" data-lake-card="codeblock" contenteditable="false" data-card-value="data:%7B%22mode%22%3A%22plain%22%2C%22code%22%3A%22cat%20%3C%20%2Fetc%2Fsysctl.d%2Fk8s.conf%5Cnnet.bridge.bridge-nf-call-ip6tables%20%3D%201%5Cnnet.bridge.bridge-nf-call-iptables%20%3D%201%5CnEOF%5Cnsysctl%20--system%22%2C%22heightLimit%22%3Atrue%2C%22margin%22%3Atrue%2C%22id%22%3A%22WocZV%22%7D" id="WocZV" class="lake-card-margin" data-language="plain"><div class="lake-codeblock-content" style="border: 1px solid rgb(232, 232, 232); max-width: 750px; color: rgb(51, 51, 51); margin: 0px; padding: 0px; background: rgb(249, 249, 249);"><div class="CodeMirror-sizer" style="margin: 0px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);"><pre class="cm-s-default" style="margin-top: 14px; margin-bottom: 14px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);">cat < /etc/sysctl.d/k8s.confnet.bridge.bridge-nf-call-ip6tables = 1net.bridge.bridge-nf-call-iptables = 1EOFsysctl --system</pre></div></div></div><p data-lake-id="8c8e616a9b9d82f6d311a325c8ba5d20" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p data-lake-id="c47993e3ce443139553eb8ad11367eae" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">5.7. 通过镜像安装k8s</p><p data-lake-id="5d0cfbba2250a53113008324ab4c8cc8" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><div data-card-type="block" data-lake-card="codeblock" contenteditable="false" data-card-value="data:%7B%22mode%22%3A%22plain%22%2C%22code%22%3A%22cd%20%2Fusr%2Flocal%2Fk8s-install%2Fkubernetes-1.14%5Cndocker%20load%20-i%20k8s-114-images.tar.gz%5Cndocker%20load%20-i%20flannel-dashboard.tar.gz%22%2C%22heightLimit%22%3Atrue%2C%22margin%22%3Atrue%2C%22id%22%3A%220WYkp%22%7D" id="0WYkp" class="lake-card-margin" data-language="plain"><div class="lake-codeblock-content" style="border: 1px solid rgb(232, 232, 232); max-width: 750px; color: rgb(51, 51, 51); margin: 0px; padding: 0px; background: rgb(249, 249, 249);"><div class="CodeMirror-sizer" style="margin: 0px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);"><pre class="cm-s-default" style="margin-top: 14px; margin-bottom: 14px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);">cd /usr/local/k8s-install/kubernetes-1.14docker load -i k8s-114-images.tar.gzdocker load -i flannel-dashboard.tar.gz</pre></div></div></div><p data-lake-id="0a4e4fa1cbcf52ed51c5156f28c77bf8" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p class="maodian"></p><h3>6.安装kubeadm并创建K8S集群</h3><p data-lake-id="c733ba709b05c10d626a7e38a813ba92" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">6.1. master主服务器配置</p><p data-lake-id="8d71236c74b00f6bc0a0ca7f748cb3fe" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><div data-card-type="block" data-lake-card="codeblock" contenteditable="false" data-card-value="data:%7B%22mode%22%3A%22plain%22%2C%22code%22%3A%22kubeadm%20init%20--kubernetes-version%3Dv1.14.1%20--pod-network-cidr%3D10.244.0.0%2F16%5Cn%5Cnmkdir%20-p%20%24HOME%2F.kube%5Cnsudo%20cp%20-i%20%2Fetc%2Fkubernetes%2Fadmin.conf%20%24HOME%2F.kube%2Fconfig%5Cnsudo%20chown%20(%20i%20d%20%E2%88%92%20u%20)%20%3A%20(id%20-u)%3A(id%E2%88%92u)%3A(id%20-g)%20%24HOME%2F.kube%2Fconfig%5Cn%5Cnkubectl%20get%20nodes%5Cn%23%E6%9F%A5%E7%9C%8B%E5%AD%98%E5%9C%A8%E9%97%AE%E9%A2%98%E7%9A%84pod%5Cnkubectl%20get%20pod%20--all-namespaces%5Cn%23%E8%AE%BE%E7%BD%AE%E5%85%A8%E5%B1%80%E5%8F%98%E9%87%8F%5Cn%23%E5%AE%89%E8%A3%85flannel%E7%BD%91%E7%BB%9C%E7%BB%84%E4%BB%B6%5Cnkubectl%20create%20-f%20kube-flannel.yml%22%2C%22heightLimit%22%3Atrue%2C%22margin%22%3Atrue%2C%22id%22%3A%22IC8aY%22%7D" id="IC8aY" class="lake-card-margin" data-language="plain"><div class="lake-codeblock-content" style="border: 1px solid rgb(232, 232, 232); max-width: 750px; color: rgb(51, 51, 51); margin: 0px; padding: 0px; background: rgb(249, 249, 249);"><div class="CodeMirror-sizer" style="margin: 0px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);"><pre class="cm-s-default" style="margin-top: 14px; margin-bottom: 14px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);">kubeadm init --kubernetes-version=v1.14.1 --pod-network-cidr=10.244.0.0/16mkdir -p $HOME/.kubesudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/configsudo chown ( i d − u ) : (id -u):(id−u):(id -g) $HOME/.kube/configkubectl get nodes#查看存在问题的podkubectl get pod --all-namespaces#设置全局变量#安装flannel网络组件kubectl create -f kube-flannel.yml</pre></div></div></div><p data-lake-id="9bdc7ff4396cbabc8c516ba969935abe" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p data-lake-id="1432cc6ab0977ea1572d86422e5eda72" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">6.2. 加入NODE节点</p><p data-lake-id="2dd2a235da72a079fb5b6af747272be8" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><div data-card-type="block" data-lake-card="codeblock" contenteditable="false" data-card-value="data:%7B%22mode%22%3A%22plain%22%2C%22code%22%3A%22kubeadm%20join%20192.168.10.194%3A6443%20--token%200b15nw.w9xq58pcttqq647k%5Cn%E2%80%93discovery-token-ca-cert-hash%20sha256%3A23db3094dc9ae1335b25692717c40e24b1041975f6a43da9f43568f8d0dbac72%22%2C%22heightLimit%22%3Atrue%2C%22margin%22%3Atrue%2C%22id%22%3A%22iRrJX%22%7D" id="iRrJX" class="lake-card-margin" data-language="plain"><div class="lake-codeblock-content" style="border: 1px solid rgb(232, 232, 232); max-width: 750px; color: rgb(51, 51, 51); margin: 0px; padding: 0px; background: rgb(249, 249, 249);"><div class="CodeMirror-sizer" style="margin: 0px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);"><pre class="cm-s-default" style="margin-top: 14px; margin-bottom: 14px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);">kubeadm join 192.168.10.194:6443 --token 0b15nw.w9xq58pcttqq647k–discovery-token-ca-cert-hash sha256:23db3094dc9ae1335b25692717c40e24b1041975f6a43da9f43568f8d0dbac72</pre></div></div></div><p data-lake-id="9829792fe871e2384b33cb2e92748d3d" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p data-lake-id="f706aa455a3c9f74b701b0c8c75223ee" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">如果忘记</p><p data-lake-id="e3a532d212624d9f0024e9cfc652a72b" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">在master 上执行kubeadm token list 查看 ,在node上运行(如下ip、端口、token都是master对应的值,切记)</p><p data-lake-id="6a14246b329265f9306662765fe854e2" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><div data-card-type="block" data-lake-card="codeblock" contenteditable="false" data-card-value="data:%7B%22mode%22%3A%22plain%22%2C%22code%22%3A%22kubeadm%20join%20192.168.10.194%3A6443%20--token%200b15nw.w9xq58pcttqq647k%20--discovery-token-unsafe-skip-ca-verification%5Cn%5Cnkubectl%20get%20nodes%22%2C%22heightLimit%22%3Atrue%2C%22margin%22%3Atrue%2C%22id%22%3A%227w7Ff%22%7D" id="7w7Ff" class="lake-card-margin" data-language="plain"><div class="lake-codeblock-content" style="border: 1px solid rgb(232, 232, 232); max-width: 750px; color: rgb(51, 51, 51); margin: 0px; padding: 0px; background: rgb(249, 249, 249);"><div class="CodeMirror-sizer" style="margin: 0px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);"><pre class="cm-s-default" style="margin-top: 14px; margin-bottom: 14px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);">kubeadm join 192.168.10.194:6443 --token 0b15nw.w9xq58pcttqq647k --discovery-token-unsafe-skip-ca-verificationkubectl get nodes</pre></div></div></div><p data-lake-id="c4cad893f478ea1ae5a8528796d039da" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p data-lake-id="32110349e84418a077fde6c0f94d96d0" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">6.3. Master开启仪表盘</p><p data-lake-id="e8fdbea13aa2d9fa73f6e54afac2aac4" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><div data-card-type="block" data-lake-card="codeblock" contenteditable="false" data-card-value="data:%7B%22mode%22%3A%22plain%22%2C%22code%22%3A%22kubectl%20apply%20-f%20kubernetes-dashboard.yaml%5Cnkubectl%20apply%20-f%20admin-role.yaml%5Cnkubectl%20apply%20-f%20kubernetes-dashboard-admin.rbac.yaml%5Cnkubectl%20-n%20kube-system%20get%20svc%5Cnhttp%3A%2F%2F192.168.10.194%3A32000%20%E8%AE%BF%E9%97%AE%22%2C%22heightLimit%22%3Atrue%2C%22margin%22%3Atrue%2C%22id%22%3A%225AnyR%22%7D" id="5AnyR" class="lake-card-margin" data-language="plain"><div class="lake-codeblock-content" style="border: 1px solid rgb(232, 232, 232); max-width: 750px; color: rgb(51, 51, 51); margin: 0px; padding: 0px; background: rgb(249, 249, 249);"><div class="CodeMirror-sizer" style="margin: 0px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);"><pre class="cm-s-default" style="margin-top: 14px; margin-bottom: 14px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);">kubectl apply -f kubernetes-dashboard.yamlkubectl apply -f admin-role.yamlkubectl apply -f kubernetes-dashboard-admin.rbac.yamlkubectl -n kube-system get svchttp://192.168.10.194:32000 访问</pre></div></div></div><p data-lake-id="5079bc603f4c623e795bdabc014313bb" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p class="maodian"></p><h3>7.遇到的坑</h3><p data-lake-id="f716fbe28f2ffc3cdadbe805d51e518d" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">7.1.最开始在自己本地的虚拟机进行安装的由于分配的cpu为1,结果执行6.1步骤的时候报错了,错误提示很明确最少需要2cpu</p><p data-lake-id="7dc022263ba5c5541996dd499ef00217" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">7.2.后来在以上机器配置中进行5.2中安装docker遇到如下版本号冲突问题,于是百度下载对应版本号的包替换即可(让版本号一致)</p><p data-lake-id="eeff4cfb5351a85b45449ce9197825c3" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p data-lake-id="2697956742f36f4bd5bce6801c1abb21" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">错误:软件包:policycoreutils-python-2.5-29.el7_6.1.x86_64 (/policycoreutils-python-2.5-29.el7_6.1.x86_64)</p><p data-lake-id="1f73658c53faf2c69bbb98023b98f12e" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">需要:policycoreutils = 2.5-29.el7_6.1</p><p data-lake-id="343775f1d8dad33e07f64bc83d40920a" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">已安装: policycoreutils-2.5-33.el7.x86_64 (@anaconda)</p><p data-lake-id="a0d0577638f8f67eecb85b8aaa2a275c" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">policycoreutils = 2.5-33.el7</p><p data-lake-id="d78f988898e8a33b39099608836128aa" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">可用: policycoreutils-2.5-34.el7.x86_64 (base)</p><p data-lake-id="3fe9079a844451f77c5532e5b7db55b9" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">policycoreutils = 2.5-34.el7</p><p data-lake-id="1099a0c9043e8d4729089903f1cc66a9" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">错误:软件包:audit-libs-python-2.8.4-4.el7.x86_64 (/audit-libs-python-2.8.4-4.el7.x86_64)</p><p data-lake-id="b6051f452f4b248e4bacdf0ba96319ce" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">需要:audit-libs(x86-64) = 2.8.4-4.el7</p><p data-lake-id="9aec942b42a23c4f3133c9202060b7f1" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">已安装: audit-libs-2.8.5-4.el7.x86_64 (@anaconda)</p><p data-lake-id="00540846e2a5dfa57164954fb9d5883b" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">audit-libs(x86-64) = 2.8.5-4.el7</p><p data-lake-id="3831d738508a54d26a18ce3c9658624b" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p data-lake-id="406de1cc665e56e2af1fc099070af14c" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">7.3.执行6.3加入node节点的时候,在node机器输入的命令一直是node机器的ip结果总是报错;后来才恍然大悟,需要用master机器的ip</p><p data-lake-id="7d98f06350c09d45505434e77adaf507" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><p data-lake-id="e97f21dfff7b3673ca45bb3816240b93" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">7.4.执行6.3加入node节点的时候,token过期,导致无法加入</p><p data-lake-id="9409a6855fcc9cb0e7c924f68a06a120" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;">如果遇到如下问题,可能是token过期了,需要执行 kubeadm token create重新获取token</p><p data-lake-id="b762546227852fd5a85385aacf1eb554" style="font-size: 14px; color: rgb(38, 38, 38); line-height: 1.74; letter-spacing: 0.05em; outline-style: none; overflow-wrap: break-word; margin-top: 0px; margin-bottom: 0px;"><br/></p><div data-card-type="block" data-lake-card="codeblock" contenteditable="false" data-card-value="data:%7B%22mode%22%3A%22plain%22%2C%22code%22%3A%22%5Bpreflight%5D%20Running%20pre-flight%20checks%5Cn%5Bpreflight%5D%20Reading%20configuration%20from%20the%20cluster%E2%80%A6%5Cn%5Bpreflight%5D%20FYI%3A%20You%20can%20look%20at%20this%20config%20file%20with%20%E2%80%98kubectl%20-n%20kube-system%20get%20cm%20kubeadm-config%20-oyaml%E2%80%99%5Cnerror%20execution%20phase%20preflight%3A%20unable%20to%20fetch%20the%20kubeadm-config%20ConfigMap%3A%20failed%20to%20get%20config%20map%3A%20Unauthorized%22%2C%22heightLimit%22%3Atrue%2C%22margin%22%3Atrue%2C%22id%22%3A%22fItWC%22%7D" id="fItWC" class="lake-card-margin" data-language="plain"><div class="lake-codeblock-content" style="border: 1px solid rgb(232, 232, 232); max-width: 750px; color: rgb(51, 51, 51); margin: 0px; padding: 0px; background: rgb(249, 249, 249);"><div class="CodeMirror-sizer" style="margin: 0px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);"><pre class="cm-s-default" style="margin-top: 14px; margin-bottom: 14px; padding: 0px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0);"> Running pre-flight checks Reading configuration from the cluster… FYI: You can look at this config file with ‘kubectl -n kube-system get cm kubeadm-config -oyaml’error execution phase preflight: unable to fetch the kubeadm-config ConfigMap: failed to get config map: Unauthorized</pre></div></div></div><p><br/></p>
頁:
[1]