原文链接
1、安装要求
在开始之前,部署Kubernetes集群机器需要满足以下几个条件:
(1)一台或多台机器,操作系统 CentOS7.x-86_x64 (2)硬件配置:2GB或更多RAM,2个CPU或更多CPU,硬盘30GB或更多 (3)可以访问外网,需要拉取镜像,如果服务器不能上网,需要提前下载镜像并导入节点 (4)禁止swap分区
2、准备环境
角色 IP 用途 k8s-master 192.168.1.76 master节点 k8s-node01 192.168.1.77 node节点 k8s-node02 192.168.1.78 node节点 k8s-server 192.168.1.79 rancher-server节点 以下操作在全部节点进行:
# 关闭防火墙 systemctl stop firewalld # 禁用防火墙 systemctl disable firewalld # 关闭selinux setenforce 0 # 临时 sed -i 's/enforcing/disabled/' /etc/selinux/config # 永久 # 关闭swap swapoff -a # 临时 sed -ri 's/.*swap.*/#&/' /etc/fstab # 永久 关闭后需要重启服务器 # 根据规划设置主机名 hostnamectl set-hostname <hostname> # 在master添加hosts cat >> /etc/hosts << EOF 192.168.1.76 k8s-master 192.168.1.77 k8s-node01 192.168.1.78 k8s-node02 192.168.1.79 k8s-server EOF # 将桥接的IPv4流量传递到iptables的链 vim /etc/sysctl.conf cat > /etc/sysctl.conf << EOF net.ipv4.ip_forward = 1 net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 EOF sysctl --system # 生效 # 时间同步 yum install ntpdate -y ntpdate time.windows.com
3、安装rancher
(1)安装docker
(2)启动rancher(k8s-rancher-server)
mkdir -p /data/rancher2.7.9 docker run -d --privileged -p 80:80 -p 443:443 -v /data/rancher2.7.9:/var/lib/rancher --restart=always --name rancher2.7.9 rancher/rancher:v2.7.9
(3)访问https://192.168.1.79,设置admin的用户密码,最低12位
(4)创建集群
(4.1)选择自定义集群

(4.2)基本信息

最低0.47元/天 解锁文章
1956

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



