k8s部署1-环境要求
AI-摘要
KunKunYu GPT
AI初始化中...
介绍自己
生成本文简介
推荐相关文章
前往主页
前往tianli博客
k8s部署-1-环境要求
主机列表
master1 192.168.0.26
master2
master3
node1 192.168.0.134
node2 192.168.0.70
node3
环境要求
centos7.7版本
cpu 2核
内存 4G
一准备工作
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
1 更新包 增加yum源
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
yum clean all
yum -y makecache
yum install -y git vim lrzsz unzip lsof wget ntp ntpdate
ntpdate 0.asia.pool.ntp.org
2 修改主机名/查看修改结果/设置hostname 解析
hostnamectl set-hostname master1
more /etc/hostname
hostnamectl status
echo "127.0.0.1 $(hostname)" >> /etc/hosts
3 禁用swap
swapoff -a
sed -i.bak '/swap/s/^/#/' /etc/fstab
4 增加br_netfilter模块
cat > /etc/rc.sysinit << EOF
#!/bin/bash
for file in /etc/sysconfig/modules/*.modules ; do
[ -x $file ] && $file
done
EOF
cat > /etc/sysconfig/modules/br_netfilter.modules << EOF
modprobe br_netfilter
EOF
chmod 755 /etc/sysconfig/modules/br_netfilter.modules
5 内核参数永久修改
sysctl net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-iptables = 1
sysctl net.bridge.bridge-nf-call-ip6tables=1
net.bridge.bridge-nf-call-ip6tables = 1
cat <<EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl -p /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
6 免密登陆ssh master1-3执行(手动操作)/把master1-3 id_rsa.pub 复制为一个里面 传输到所有的服务器
ssh-keygen -t rsa
7 node节点执行
ssh-keygen
cd /root/.ssh/
cat id_rsa.pub >> authorized_keys
scp authorized_keys root@node节点ip:~/.ssh/
kubectl config set-context dev --namespace=development --cluster=lkubernetes-admin@kubernetes --user=kubernetes-admin@kubernetes
kubectl config set-context prod --namespace=production --cluster=kubernetes-admin@kubernetes --user=kubernetes-admin@kubernetes
- 感谢你赐予我前进的力量
赞赏者名单
因为你们的支持让我意识到写文章的价值🙏
作者编辑不易,如有转载请注明出处。完整转载来自https://wangairui.com 网站名称:猫扑linux
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果