linux怎么查看本机内存大小
296
2022-09-11
k8s系列-07-kubespray方案基础环境准备
主旨
我们前面介绍了三种部署方案,分别是kubespray、kubeadm、kubernetes-the-hard-way,我们首先使用kubespray的方式来进行部署一下,往下看。
环境由于我是测试环境,所以按照最节省资源的方式来进行,资源如下:
hostname | IP地址 | 角色 | cpu | memory |
node-1 | 192.168.112.130 | master | >=2 | >=2 |
node-2 | 192.168.112.131 | master | >=2 | >=2 |
node-3 | 192.168.112.132 | worker | >=2 | >=2 |
修改主机名
192.168.112.130 操作,操作完毕之后需要重新连接:
[yunweijia@localhost ~]$ sudo vim /etc/hostname# 清空文件原内容,写入下面信息node-1[yunweijia@localhost ~]$ sudo hostname node-1[yunweijia@localhost ~]$ bash[yunweijia@node-1 ~]$
192.168.112.131 操作:
[yunweijia@localhost ~]$ sudo vim /etc/hostname# 清空文件原内容,写入下面信息node-2[yunweijia@localhost ~]$ sudo hostname node-2[yunweijia@localhost ~]$ bash[yunweijia@node-2 ~]$
192.168.112.132 操作,操作完毕之后需要重新连接:
[yunweijia@localhost ~]$ sudo vim /etc/hostname# 清空文件原内容,写入下面信息node-3[yunweijia@localhost ~]$ sudo hostname node-3[yunweijia@localhost ~]$ bash[yunweijia@node-3 ~]$
PS:下面直接按照主机名来代替,就不单独以IP 地址来表明是哪台服务器了。
关闭安全策略
以下步骤,要在所有的服务器上进行操作,操作内容一致,只写一遍了。关闭防火墙:
[yunweijia@node-1 ~]$ sudo systemctl stop firewalld.service[yunweijia@node-1 ~]$ sudo systemctl disable firewalld.service
关闭selinux:
[yunweijia@node-1 ~]$ sudo setenforce 0[yunweijia@node-1 ~]$ sudo vim /etc/selinux/config SELINUX=enforcing # 该行注释掉,新建行内容如下:SELINUX=disabled[yunweijia@node-1 ~]$
设置iptables规则,该条命令必须在root用户中执行:
[yunweijia@node-1 ~]$ su root密码:[root@node-1 yunweijia]# iptables -F && iptables -X && iptables -F -t nat && iptables -X -t nat && iptables -P FORWARD ACCEPT[root@node-1 yunweijia]# exitexit[yunweijia@node-1 ~]$
关闭dnsmasq(否则可能导致容器无法解析域名)
[yunweijia@node-1 ~]$ sudo service dnsmasq stopRedirecting to /bin/systemctl stop dnsmasq.service[yunweijia@node-1 ~]$ sudo systemctl disable dnsmasq[yunweijia@node-1 ~]$
K8s参数设置
以下步骤,要在所有的服务器上进行操作,操作内容一致,只写一遍了。
[yunweijia@node-1 ~]$ sudo vim /etc/sysctl.d/kubernetes.conf net.bridge.bridge-nf-call-ip6tables = 1net.bridge.bridge-nf-call-iptables = 1net.ipv4.ip_nonlocal_bind = 1net.ipv4.ip_forward = 1vm.swappiness = 0vm.overcommit_memory = 1[yunweijia@node-1 ~]$ sudo sysctl -p /etc/sysctl.d/kubernetes.conf
移除docker软件相关包以下步骤,要在所有的服务器上进行操作,操作内容一致,只写一遍了。
[yunweijia@node-1 ~]$ sudo yum remove -y docker*[yunweijia@node-1 ~]$ sudo rm -f /etc/docker/daemon.json
至此,本文结束,下一篇我们将进行kubespray的部署和安装。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~