centos 7.6.180 安装 Kubernetes 1.17.3

1 准备三台虚拟机

配置2核2G

 172.16.159.165 master1.k8s 
 172.16.159.166 node1.k8s
 172.16.159.167 node2.k8s
修改主机名
在master1.k8s (172.16.159.165)上:
hostnamectl set-hostname master1.k8s 

node1.k8s(172.16.159.166)上:
hostnamectl set-hostname node1.k8s

node2.k8s(172.16.159.167)上:
hostnamectl set-hostname node2.k8s

2 修改hosts

master1.k8s,node1.k8s,node2.k8s 三台机器都需要操作。

cat >> /etc/hosts << EOF 
 172.16.159.165 master1.k8s 
 172.16.159.166 node1.k8s
 172.16.159.167 node2.k8s
EOF

3 关闭防火墙,禁用selinux,禁用 swap

master1.k8s,node1.k8s,node2.k8s 三台机器都需要操作。

3.1 关闭防火墙

关闭并禁用防火墙
[root@master1 ~]# systemctl stop firewalld && systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

查看默认防火墙状态(关闭后显示not running,开启后显示running)
[root@master1 ~]# firewall-cmd --state
not running

清除防火墙规则(否则pod及容器无法跨主机互通问题)

iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -F
iptables -L -n

3.2 禁用selinux

关闭Selinux
[root@master1 ~]# setenforce 0
[root@master1 ~]# sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config

重启
[root@master1 ~]# reboot

查看Selinux状态
[root@master1 ~]# sestatus
SELinux status:                 disabled

3.3 禁用swap

[root@master1 ~]# swapoff -a
[root@master1 ~]# sed -i 's/.*swap.*/#&/' /etc/fstab
[root@master1 ~]# free
              total        used        free      shared  buff/cache   available
Mem:        2030472       79496     1826568        8952      124408     1797140
Swap:             0           0           0
[root@master1 ~]#

4 修改系统配置

4.1 net.bridge

一些 RHEL/CentOS 7 的用户曾经遇到过问题:
由于 iptables 被绕过而导致流量无法正确路

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值