1

环境准备

虚拟机

主机名 IP OS 角色
host01 192.168.31.63 CentOS 7 Master & Node
虚拟机需要和外网通信,需要配置EIP

配置主机名

[root@host01 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.31.63 host01

配置网络代理(有条件可选)

export http_proxy="http://用户名:密码@代理IP:端口"
export https_proxy="https://用户名:密码@代理IP:端口"
export NO_PROXY="127.0.0.1,localhost"
可选,如果访问外网需要代理请正确填写用户名、密码、代理IP和端口,追加以上内容到/root/.bashrc,执行命令使其生效
[root@host01 ~]# source /root/.bashrc

配置Yum代理(有条件可选)

追加上一步代理配置内容到/etc/yum.conf

关闭防火墙

[root@host01 ~]# systemctl stop firewalld
[root@host01 ~]# systemctl disable firewalld

禁用SELINUX

[root@host01 ~]# cat /etc/selinux/config | grep SELINUX=
# SELINUX=disabled
SELINUX=disabled
[root@host01 ~]# setenforce 0
确保SELINUX=disabled

配置系统项

[root@host01 ~]# cat /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
vm.swappiness=0
[root@host01 ~]# sysctl -p /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
vm.swappiness = 0
新建/etc/sysctl.d/k8s.conf并追加相应内容

关闭SWAP

[root@host01 ~]# swapoff -a

xied5531
77 声望0 粉丝