網站首頁 編程語言 正文
生產級K8S基礎環境部署:
配置本地hosts文件(有多少臺,配置多少臺)
vim /etc/hosts 192.168.1.5 k8s-master
配置yum源(有自己的yum源更好)
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
安裝基礎工具,配置docker源
sudo yum install -y yum-utils device-mapper-persistent-data lvm2 sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo sudo sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo sudo yum makecache fast
安裝一些必備工具
yum -y install wget jq psmisc vim net-tools telnet yum-utils device-mapper-persistent-data lvm2 git -y
關閉防火墻
systemctl disable --now firewalld
關閉SELinux
setenforce 0 sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinux
關閉交換分區
swapoff -a && sysctl -w vm.swappiness=0 cat /etc/fstab # /dev/mapper/centos-swap swap swap defaults 0 0
關閉NetworkManager
systemctl disable --now NetworkManager
進行時間同步(有自己的時間服務器更好)
# 安裝 rpm -ivh http://mirrors.wlnmp.com/centos/wlnmp-release-centos.noarch.rpm yum -y install ntpdate # 同步 ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime echo 'Asia/Shanghai' >/etc/timezone ntpdate ntp.aliyun.com crontab -e crontab -l */5 * * * * ntpdate ntp.aliyun.com
配置ulimit
ulimit -SHn 65535 vim /etc/security/limits.conf * soft nofile 655360 * hard nofile 131072 * soft nproc 655350 * hard nproc 655350 * seft memlock unlimited * hard memlock unlimitedd
配置免密登錄(從主master向其他節點分發)
ssh-keygen -t rsa ssh-copy-id -i .ssh/id_rsa.pub 其他主機
升級系統到最新(跳過內核)
yum update -y --exclude=kernel*
升級內核至4.18版本以上?
cd /root/ wget http://193.49.22.109/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-4.19.12-1.el7.elrepo.x86_64.rpm wget http://193.49.22.109/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-devel-4.19.12-1.el7.elrepo.x86_64.rpm yum -y localinstall kernel-ml* grub2-set-default 0 && grub2-mkconfig -o /etc/grub2.cfg && grubby --args="user_namespace.enable=1" --update-kernel="$(grubby --default-kernel)" reboot uname -r
安裝ipvsadm
yum install ipvsadm ipset sysstat conntrack libseccomp –y vim /etc/modules-load.d/ipvs.conf cat /etc/modules-load.d/ipvs.conf ip_vs ip_vs_rr ip_vs_wrr ip_vs_sh nf_conntrack ip_tables ip_set xt_set ipt_set ipt_rpfilter ipt_REJECT ipip systemctl enable --now systemd-modules-load.service lsmod | grep -e ip_vs -e nf_conntrack_ipv4 ip_vs_sh 16384 0 ip_vs_wrr 16384 0 ip_vs_rr 16384 0 ip_vs 151552 6 ip_vs_rr,ip_vs_sh,ip_vs_wrr nf_conntrack 143360 1 ip_vs libcrc32c 16384 3 nf_conntrack,xfs,ip_vs
修改內核參數
cat </etc/sysctl.d/k8s.conf net.ipv4.ip_forward = 1 net.bridge.bridge-nf-call-iptables = 1 fs.may_detach_mounts = 1 vm.overcommit_memory=1 vm.panic_on_oom=0 fs.inotify.max_user_watches=89100 fs.file-max=52706963 fs.nr_open=52706963 net.netfilter.nf_conntrack_max=2310720 net.ipv4.tcp_keepalive_time = 600 net.ipv4.tcp_keepalive_probes = 3 net.ipv4.tcp_keepalive_intvl =15 net.ipv4.tcp_max_tw_buckets = 36000 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_max_orphans = 327680 net.ipv4.tcp_orphan_retries = 3 net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_max_syn_backlog = 16384 net.ipv4.ip_conntrack_max = 65536 net.ipv4.tcp_max_syn_backlog = 16384 net.ipv4.tcp_timestamps = 0 net.core.somaxconn = 16384 EOF sysctl --system
本篇內容只講K8S部屬前的基礎環境
原文鏈接:https://yyang.blog.csdn.net/article/details/120355410
相關推薦
- 2023-07-09 echarts飄警告[ECharts] There is a chart instance alre
- 2022-08-28 點在多邊形內判定模板(射線法,凹凸多邊形均可)
- 2022-07-03 C#入門之定義類成員與接口實現_C#教程
- 2023-03-04 linux服務器CPU飆高排查分析_Linux
- 2022-04-04 使用uniapp封裝簡易通用的ajax請求以及攜帶token去請求 (代碼優化新增請求日志和響應日志
- 2023-07-09 【elementplus】解決el-table開啟show-overflow-tooltip后,to
- 2023-05-22 python使用ctypes調用第三方庫時出現undefined?symbol錯誤詳解_python
- 2022-04-10 vscode快速輸出格式化console.log
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支