一、K8S系列教程-环境准备

一、安装环境说明

硬件要求

内存:2GB或更多RAM

CPU: 2核CPU或更多CPU

硬盘: 30GB或更多

本次环境说明:
操作系统:CentOS 7.9

内核版本:3.10.0-1160

master: 192.168.145.147

node01: 192.168.145.148

node02: 192.168.145.149

二、准备环境

  1. 关闭防火墙和selinux

    systemctl stop firewalld && systemctl disable firewalld && iptables -F
    #关闭selinux
    sed -i 's/enforcing/disabled/' /etc/selinux/config && setenforce 0
  2. 关闭swap分区

    #临时关闭
    swapoff -a
    #永久关闭
    sed -ri 's/.*swap.*/#&/' /etc/fstab
  3. 修改hosts文件,三台虚机都要更改

    cat >> /etc/hosts << EOF
    192.168.145.147 master.local
    192.168.145.148 node01.local
    192.168.145.149 node02.local
    EOF

    file

  4. 修改内核文件

    cat > /etc/sysctl.d/k8s.conf << EOF
    net.bridge.bridge-nf-call-ip6tables = 1
    net.bridge.bridge-nf-call-iptables = 1
    net.ipv4.ip_forward = 1
    EOF
    sysctl --system
  5. 加载ip_vs内核模块,本文使用iptables

    modprobe ip_vs
    modprobe ip_vs_rr
    modprobe ip_vs_wrr
    modprobe ip_vs_sh
    modprobe nf_conntrack_ipv4
  6. 设置开机启动

    cat > /etc/modules-load.d/ip_vs.conf << EOF 
    ip_vs
    ip_vs_rr
    ip_vs_wrr
    ip_vs_sh
    nf_conntrack_ipv4
    EOF
一、K8S系列教程-环境准备https://xucg.info/2023/03/20/2749.html
THE END
分享
二维码
< <上一篇
下一篇>>