(1)环境搭建-集群安装

查看所需镜像


定义下载镜像

循环下载镜像:

下载完成之后:查看一下镜像,名字也已经改成了k8s的名字




集群初始化只在master节点上运行,

出现sucessfully表示成功,提示要运行几条命令:


在集群中加入一些工作节点,可以查看一下现在有哪些节点:

在node节点上执行这些代码,加入集群:

添加节点:

在100查看:
添加:"
添加完之后在次查看:

可以看到状态是NotReday,由于网络插件没有安装,各个节点此时还不能通信的
(2)环境搭建-网络插件安装

这个文件提前下载到电脑了:

也修改了里面的quary...

进行上传:
运行安装命令:

查看一下节点状态:
(3)环境搭建-环境测试
我们测试以下集群安装是否成功,我们在集群上跑一个nginx程序,看是否能够了跑起来

在master节点上操作:
部署nginx:kubectl

暴露端口:80

查看服务状态:
我们的程序在容器里,容器在Pod里,pod是正常运行的,程序跟容器也应该是正常的

查看service:
30518是暴露给外边的端口:可以通过ip+端口访问nginx

能够正常访问说明nginx在正常工作了,集群也是可以正常访问的,
