二进制部署1.23.4版本k8s集群-1-系统安装及环境准备
1. 致谢
这篇文章参考了老男孩王导的视频,在此表示感谢和致敬!
2. 安装CentOS操作系统
系统镜像:CentOS-7-x86_64-DVD-2009.iso
安装过程略。
3. 环境准备
3.1 修改主机名
[root@CentOS-11 ~]# hostnamectl set-hostname cfzx55-11.host.com
[root@CentOS-11 ~]# logout
[root@cfzx55-11 ~]# hostname
cfzx55-11.host.com
[root@cfzx55-11 ~]#
3.2 修改IP地址
[root@cfzx55-11 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
[root@cfzx55-11 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
NAME="eth0"
DEVICE="eth0"
ONBOOT="yes"
IPADDR=10.211.55.11
NETMASK=255.255.255.0
GATEWAY=10.211.55.1
DNS1=10.211.55.1
3.3 关闭IPV6地址
[root@cfzx55-11 ~]# vi /etc/default/grub
[root@cfzx55-11 ~]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="ipv6.disable=1 crashkernel=auto spectre_v2=retpoline rd.lvm.lv=centos_centos-11/root rd.lvm.lv=centos_centos-11/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
[root@cfzx55-11 ~]#
GRUB_CMDLINE_LINUX中增加ipv6.disable=1
[root@cfzx55-11 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-1160.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-64ff7fa49756f945a81d0b1b41f366c5
Found initrd image: /boot/initramfs-0-rescue-64ff7fa49756f945a81d0b1b41f366c5.img
done
[root@cfzx55-11 ~]# reboot
3.4 关闭SELinux
[root@cfzx55-11 ~]# vi /etc/selinux/config
[root@cfzx55-11 ~]# cat /etc/selinux/config | grep SELINUX=
# SELINUX= can take one of these three values:
SELINUX=disabled
[root@cfzx55-11 ~]#
3.5 关闭防火墙
[root@cfzx55-11 ~]# systemctl stop firewalld
[root@cfzx55-11 ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@cfzx55-11 ~]#
3.6 关闭邮件服务
[root@cfzx55-11 ~]# systemctl stop postfix
[root@cfzx55-11 ~]# systemctl disable postfix
Removed symlink /etc/systemd/system/multi-user.target.wants/postfix.service.
[root@cfzx55-11 ~]#
3.7 安装常用软件
[root@cfzx55-11 ~]# yum install -y wget vim net-tools
3.8 调整base源、EPEL源,添加K8S源
# 备份
[root@cfzx55-11 ~]# mv /etc/yum.repos.d/CentOS-Base.repo{,.bak}
# 使用阿里镜像源
[root@cfzx55-11 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
2022-02-27 14:25:05 (2.06 MB/s) - '/etc/yum.repos.d/CentOS-Base.repo' saved [2523/2523]
# 安装epel源
[root@cfzx55-11 ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
2022-02-27 14:26:02 (84.3 MB/s) - '/etc/yum.repos.d/epel.repo' saved [664/664]
[root@cfzx55-11 ~]# vim /etc/yum.repos.d/k8s.repo
[root@cfzx55-11 ~]# cat /etc/yum.repos.d/k8s.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
# 清除系统yum缓存,重新生成
[root@cfzx55-11 ~]# yum clean all
[root@cfzx55-11 ~]# yum makecache -y
# 查看系统可用yum源和所有yum源
[root@cfzx55-11 ~]# yum repolist enabled
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
repo id repo name status
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10072
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13746
extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 509
kubernetes Kubernetes 775
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 3572
repolist: 28674
[root@cfzx55-11 ~]#
3.9 时间同步
# 查看系统时间、时区
[root@cfzx55-11 ~]# timedatectl
[root@cfzx55-11 ~]# timedatectl list-timezones | grep -i shanghai
Asia/Shanghai
[root@cfzx55-11 ~]# timedatectl set-timezone Asia/Shanghai
[root@cfzx55-11 ~]# timedatectl status
Local time: Sat 2022-03-12 14:36:48 CST
Universal time: Sat 2022-03-12 06:36:48 UTC
RTC time: Sat 2022-03-12 06:36:48
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
[root@cfzx55-11 ~]#
# 安装chrony
[root@cfzx55-11 ~]# yum -y install chrony
# 配置chrony
[root@cfzx55-11 ~]# vim /etc/chrony.conf
[root@cfzx55-11 ~]# cat /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server ntp1.alyun.com
server ntp2.alyun.com
server ntp3.alyun.com
# 启动 chrony
[root@cfzx55-11 ~]# systemctl start chronyd
# 设为开机自启动
[root@cfzx55-11 ~]# systemctl enable chronyd
3.10 关闭swap分区
[root@cfzx55-11 ~]# vim /etc/fstab
# 注释swap一行
3.11 内核优化
[root@cfzx55-11 ~]# vim /etc/sysctl.d/k8s.conf
[root@cfzx55-11 ~]# cat /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-ip6tables=1
net.ipv4.ip_forward=1
net.ipv4.tcp_tw_recycle=0
[root@cfzx55-11 ~]# sysctl --system
3.12 克隆虚拟机:
共5台虚拟机,克隆完成后,修改IP地址和hostname
| 序号 | IP地址 | hostname |
|---|---|---|
| 1 | 10.211.55.11 | cfzx55-11.host.com |
| 2 | 10.211.55.12 | cfzx55-12.host.com |
| 3 | 10.211.55.21 | cfzx55-21.host.com |
| 4 | 10.211.55.22 | cfzx55-22.host.com |
| 5 | 10.211.55.200 | cfzx55-200.host.com |
二进制部署1.23.4版本k8s集群-1-系统安装及环境准备的更多相关文章
- 二进制部署1.23.4版本k8s集群-5-部署Master节点服务
1.安装Docker 在21.22.200三台机器上安装Docker.安装命令: 在21.22.200三台主机上部署Docker. ~]# curl -fsSL https://get.docker. ...
- 二进制部署1.23.4版本k8s集群-6-部署Node节点服务
本例中Master节点和Node节点部署在同一台主机上. 1 部署kubelet 1.1 集群规划 主机名 角色 IP CFZX55-21.host.com kubelet 10.211.55.21 ...
- 二进制部署1.23.4版本k8s集群-2-安装DNS服务
2.安装DNS服务 为什么要安装bind9? K8S中,使用Ingress进行7层流量调度,需要使用域名,进行7层调度. 以前使用绑定host的方法,来进行域名和IP地址的解析. 在K8S里,没有好的 ...
- 1.还不会部署高可用的kubernetes集群?看我手把手教你使用二进制部署v1.23.6的K8S集群实践(上)
公众号关注「WeiyiGeek」 设为「特别关注」,每天带你玩转网络安全运维.应用开发.物联网IOT学习! 本章目录: 0x00 前言简述 0x01 环境准备 主机规划 软件版本 网络规划 0x02 ...
- 使用kubeadm部署一套高可用k8s集群
使用kubeadm部署一套高可用k8s集群 有疑问的地方可以看官方文档 准备环境 我的机器如下, 系统为ubuntu20.04, kubernetes版本1.21.0 hostname IP 硬件配置 ...
- 基于 kubeadm 部署单控制平面的 k8s 集群
单控制平面不符合 HA 要求,但用于开发/测试环境不会有任何问题,如果资源足够的话(10台以上服务器,3台用于APIserver.3台用于 etcd 存储.至少3台用于工作节点.1台作为负载均衡),可 ...
- 【k8s学习笔记】使用 kubeadm 部署 v1.18.5 版本 Kubernetes集群
说明 本文系搭建kubernetes v1.18.5 集群笔记,使用三台虚拟机作为 CentOS 测试机,安装kubeadm.kubelet.kubectl均使用yum安装,网络组件选用的是 flan ...
- 京东云开发者|IoT运维 - 如何部署一套高可用K8S集群
环境 准备工作 配置ansible(deploy 主机执行) # ssh-keygen # for i in 192.168.3.{21..28}; do ssh-copy-id -i ~/.ssh/ ...
- linux下部署Elasticsearch6.8.1版本的集群
一.准备工作 安装包的下载:elasticsearch-6.8.1.tar.gz 集群服务器:A B 一.单节点elasticsearch的安装部署 a.进入es的下载目录home:解压tar ...
随机推荐
- 布客·ApacheCN 编程/后端/大数据/人工智能学习资源 2021.7
公告 ApacheCN 翻译预计将于半年内恢复. 我们的开源项目必须有中文的 README,如果是文档类项目,必须全部中文,否则将会被清理.请大家贡献项目时一定要留意. 我们目标是[财务自由+情感自由 ...
- springboot加载外部配置文件
网上搜集和整理如下(自己已验证过) 1. war包在tomcat中加载外部配置文件 war包运行在独立tomcat下时,如何加载war包外部配置application.properties,以达到每次 ...
- 自定义 RestTemplate 异常处理 (转)
转自:https://ethendev.github.io/2018/11/06/RestTemplate-error-handler/ 一些 API 的报错信息通过 Response 的 body返 ...
- 聊聊DevOps制品管理-不止是存储制品这么简单
什么是制品? 制品是指由源码编译打包生成的二进制文件,不同的开发语言对应着不同格式的二进制文件:这些二进制文件通常用于运行在服务器上或者作为编译依赖,"制品的管理"是配置管理的重要 ...
- verification 时间不推进,挂起
时间不推进,挂起 0时刻 windows-> new -> source Browser 可能是仿真精度不够,比如进度是1ns,但是时钟有0.1ns为周期的,这种情况下,仿真器会吧这个周期 ...
- 如何强制关闭Win10自动更新
今天我向往常一样打开了电脑,在工作时突然感觉CPU风扇嗡嗡的响电脑开始变得极慢内存也开始上涨,我意识到不妙了,Windows10 又开始在后台给我搞事情了,由于我的电脑安装有开机还原功能,所以每次开机 ...
- MyBatis辅助功能点三:延迟加载
延迟加载即先加载必需信息,然后再根据需要进一步加载信息的方式.实际应用如:常出现先查询表A,再根据表A的输出结果查询表B的情况.而有些时候,从A表查询出来的数据,只有一部分要查询表B.这时用延迟加载就 ...
- 《SelfClass》——Docker
<SelfClass>--Docker 根据我的个人计划,我需要先了解一下Docker,并且能够使用起来. 目的:在我Mac上搭建一个Docker,在Docker上搭建一个MySQL数据库 ...
- 【Kotlin】初识Kotlin(二)
[Kotlin]初识Kotlin(二) 1.Kotlin的流程控制 流程控制是一门语言中最重要的部分之一,从最经典的if...else...,到之后的switch,再到循环控制的for循环和while ...
- [LeetCode]剑指 Offer 17. 打印从1到最大的n位数
输入数字 n,按顺序打印出从 1 到最大的 n 位十进制数.比如输入 3,则打印出 1.2.3 一直到最大的 3 位数 999. 示例 1: 输入: n = 1 输出: [1,2,3,4,5,6,7, ...