目录
5 设置三台服务器之间免密 执行完后务必退出shell然后重连
6 安装kubesphere必要依赖,每个节点都要装,不然报错:socat not found in system path
8 只用在主节点k8s-node1文件夹中下载k8s安装脚本 没有配置镜像加速可能会很慢多试几次
9 集群配置,创建配置文件,config-sample.yaml
12 耐心等待安装完成,会把所有工作节点添加到k8s-node1(时间大概5-10分钟)
1准备3台虚拟机(centos7.9)
cd /etc/sysconfig/network-scripts
vim ifcfg-ens33
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.211
GATEWAY=192.168.1.1
NETMASK=255.255.255.0
DNS1=114.114.114.114
2 每台虚拟机更新yum的软件包,时间设置等
yum -y update
yum makecache fast
yum install -y ntpdate
ntpdate time.windows.com
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
date
3 关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
/etc/selinux/config
将SELINUX的值设置为disabled
4 添加三台服务器的域名设置
vim /etc/hosts
192.168.1.211 node1
192.168.1.212 node2
192.168.1.213 node3
5 设置三台服务器之间免密 执行完后务必退出shell然后重连
1、先在所有服务器上执行命令:
ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
2、而后在所有服务器上执行命令:这样自身就能免密登陆
cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys
3、之后将每台服务器上的id_dsa.pub公钥发送到其他机器的/tmp文件夹下,如在master上执行
scp ~/.ssh/id_dsa.pub node2:/tmp/
scp ~/.ssh/id_dsa.pub node3:/tmp/
4、之后在其他的机器上将公钥追加到各自的authorized_keys里,执行以下命令:
cat /tmp/id_dsa.pub >>~/.ssh/authorized_keys
5、同样的,在其他的机器上将公钥发送到其他服务器上,然后在其他服务器上将公钥追加到各自的authorized_keys即可
6、最后是测试免密钥连接。
ssh node1
6 安装kubesphere必要依赖,每个节点都要装,不然报错:socat not found in system path
yum install -y socat conntrack ebtables ipset
7 安装nfs-server
#在每个机器。
yum install -y nfs-utils
#在master执行以下命令
echo "/nfs/data/ *(insecure,rw,sync,no_root_squash)" > /etc/exports
#执行以下命令, 启动nfs服务;创建共享目录
mkdir -p /nfs/data
#在master执行
systemctl enable rpcbind
systemctl enable nfs-server
systemctl start rpcbind
systemctl start nfs-server
#使配置生效
exportfs-r
#检查配置是否生效
exportfs
配置nfs-client(选做)
#改成自己的master的ip,只在从节点执行
showmount -e 192.168.1.211
mkdir -p /nfs/data
mount -t nfs 192.168.1.211:/nfs/data /nfs/data

该文详细描述了如何在三台CentOS7.9虚拟机上配置Kubernetes集群,包括更新系统、关闭防火墙、设置域名和免密登录、安装KubeSphere依赖和NFS服务器,以及配置默认存储和安装过程。同时提到了镜像加速和多租户实战的重要性。
最低0.47元/天 解锁文章
3万+

被折叠的 条评论
为什么被折叠?



