1.集群测试机器准备(虚拟机)

本文详细介绍了如何准备Kubernetes集群的测试机器,包括虚拟机网络配置、CentOS安装、内核要求、网络配置、依赖包安装、防火墙设置、SELINUX禁用、内核参数调整以及系统时区设定。通过这些步骤,确保服务器满足K8S集群的基本需求。
摘要由CSDN通过智能技术生成

1.集群测试机器准备(虚拟机)

虚拟网络

在这里插入图片描述

2. 虚拟机准备
准备一个模板虚机

后续各虚机从该模板clone出来

  1. 安装一个centos虚机
    在这里插入图片描述
    内核要求3.8以上,这里是3.10
  2. 配置网络
    vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
TYPE=Ethernet
BOOTPROTO=none
NAME=eno16777736
DEVICE=eno16777736
ONBOOT=yes
IPADDR=172.10.10.222
NETMASK=255.255.255.0
GATEWAY=172.10.10.254
DNS1=172.10.10.254

这里DNS暂时使用网关,后续会有自建DNS
systemctl restart network重启网络

从模板机clone新虚机
  • clone机器
    在这里插入图片描述

  • 配置网络
    按上节配置网络部分,修改clone出的新虚机的网络IP

安装依赖包

yum install -y wget vim net-tools git conntrack ntpdata ntp ipvsadm ipset jq iptables curl sysstat libseccomp

下部分操作为可选设置=

将防火墙设置为iptables
  • 关闭并禁用firewalld
    systemctl stop firewalld && systemctl disable firewalld
  • 安装iptables-services
    yum install iprables-services
  • 启用iptables
    systemctl start iptables && systemctl enable iptables
  • 清空规则并保存
    iptables -F
    service iptables save

    iptables-save > /etc/sysconfig/iptables 将当前规则保存到/etc/sysconfig/iptables
关闭SELINUX

setenforce 0 临时
vi /etc/selinux/config 修改SELINUX=disabled

调整内核参数

vi /etc/sysctl.d/kubernetes.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
vm.swappiness=0    # 禁用swap,只当系统OOM时才允许使用
vm.overcommit_memory=1   # 不检查物理内存是否够用
vm.panic_on_oom=0   # 开启OOM
fs.inotify.max_user_instances=8192
fs.inotify.max_user_watches=1048576
fs.file-max=52706963
fs.nr_open=52706963
net.ipv6.conf.all.disable_ipv6=1
net.netfilter.nf_conntrack_max=2310720

sysctl -p /etc/sysctl.d/kubernetes.conf

调整系统时区
  • 设置时区
    timedatectl set-timezone Asia/Shanghai
  • 将当前UTC时间写入硬件时钟
    timedatectl set-local-rtc 0
  • 下两服务依赖系统时间,进行重启(自选)
    systemctl restart rsyslog
    systemctl restart crond

可以使用chrony等时间同步方案,同步集群机器的时间
参考:https://blog.csdn.net/qq_19655405/article/details/117125079

对K8S调整内核参数

至此,我们的服务器就算准备好了
本文测试准备机器如下
在这里插入图片描述
在这里插入图片描述

========
本文后期,因资源原因,在安装完高可用集群后,集群结构会做适当缩减(不影响演示)

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hzw@sirius

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值