openEuler kubeadm安装Kubernetes
禁用或关闭服务
firewalld
systemctl stop firewalld
systemctl disable firewalld
selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
swap 分区
sed -i '/swap/s/\(.*\)/#\1/g' /etc/fstab
设置后需重启生效
设置内核
ipv4转发
sed -i 's/net.ipv4.ip_forward=0/net.ipv4.ip_forward=1/g' /etc/sysctl.conf
网桥过滤转发
cat >/etc/sysctl.d/k8s.conf<<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
vm.swappiness = 0
EOF
配置模块
cat >/etc/modules-load.d/k8s.conf<<EOF
overlay
br_netfilter
EOF
加载br_netfilter overlay模块
modprobe br_netfilter
modprobe overlay
更新内核配置
sysctl -p
sysctl -p /etc/sysctl.d/k8s.conf
安装ipset及ipvsadm
yum -y install ipset ipvsadm
配置ipvsadm模块加载
cat > /etc/sysconfig/modules/ipvs.module <<EOF
modprobe -- ip_vs
modprobe -- ip_vs_sh
modprobe -- ip_vs_rr
modprobe -- ip_vs_wrr
modprobe -- nf_conntrack
EOF
授权、运行、检查是否加载
chmod 755 /etc/sysconfig/modules/ipvs.module && /etc/sysconfig/modules/ipvs.module
查看对应的模块是否加载成功
lsmod | grep -e ip_vs -e nf_conntrack_ipv4
设置hostname
- 本机ip 10.211.55.20
- hostname dev
编辑hosts文件
sed -i '$s/\(.*\)/\1\n10.211.55.20 dev/' /etc/hosts
设置hostname
hostnamectl hostname dev
安装软件源
kubernetes
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
docker-ce
cat >/etc/yum.repos.d/dockerce.repo<<EOF
[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
安装软件
yum install -y docker-ce containerd.io kubeadm kubectl kubelet
标签:sysctl,Kubernetes,cat,etc,sed,yum,ipv4,openEuler,安装
From: https://www.cnblogs.com/hard4code/p/18258414