部署K8S集群(一):环境准备

环境介绍:
以下操作使用三台基于Hyper-v的OpenEuler虚拟机

IP 主机名 系统版本
172.17.48.27 master openeuler-22.03 LTS SP3
172.17.48.28 worker01 openeuler-22.03 LTS SP3
172.17.48.29 worker02 openeuler-22.03 LTS SP3

虚拟机准备操作:
以下操作需要在全部三台机上执行

  1. 关闭防火墙、交换区、SELinux
#关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
#关闭交换区
sed -ri 's/.*swap.*/#&/' /etc/fstab
#关闭SELinux
cp /etc/selinux/config /etc/selinux/config.bak
sed -i 's/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config
reboot
  1. 加载内核模块br_netfilter、设置允许iptables检查桥接流量
#加载br_netfilter
modprobe br_netfilter
#允许 iptables 检查桥接流量
cat > /etc/sysctl.d/k8s.conf << EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
sysctl -p /etc/sysctl.d/k8s.conf
  1. 添加阿里云yum源,写入host
# 添加阿里云 yum 源
cat > /etc/yum.repos.d/kubernetes.repo << EOF
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF

echo "172.17.48.27 master" >> /etc/hosts
echo "172.17.48.28 worker01" >> /etc/hosts
echo "172.17.48.29 worker02" >> /etc/hosts
yum update -y
yum install tar nano net-tools curl -y
posted @ 2024-09-05 13:45  Ar4te  阅读(66)  评论(1编辑  收藏  举报