CentOS8部署kubernetes及踩坑(之一)配置CentOS

手頭有兩臺服務器master01, node01.

注:以下配置過程在兩臺機器上都要執行。

1、安裝系統:

版本是CentOS8.1 ,下載地址:http://isoredirect.centos.org/centos/8/isos/x86_64/CentOS-8.1.1911-x86_64-dvd1.iso

安裝過程:略。

[root@master01 ~]# cat /etc/centos-release
CentOS Linux release 8.1.1911 (Core) 
[root@master01 ~]# 

2、修改主機名:

在兩臺機器上分別執行:

[root@master01 ~]# hostnamectl set-hostname master01.huiyan.com
[root@master01 ~]# hostname
master01.huiyan.com
[root@master01 ~]# 
[root@node01 ~]# hostnamectl set-hostname node01.huiyan.com
[root@node01 ~]# hostname
node01.huiyan.com
[root@node01 ~]# 

3、配置IP地址:

配置成靜態IP地址:略。

在兩臺機器上都修改  hosts:

[root@master01 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.100.206 master01.huiyan.com master01
192.168.100.226 node01.huiyan.com node01

4、添加國內(阿里)源:

[root@master01 ~]# rm -rfv /etc/yum.repos.d/*
[root@master01 ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo

5、配置iptables:

[root@master01 ~]# cat > /etc/sysctl.d/k8s.conf <<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system

6、安裝常用工具軟件:

[root@master01 ~]# yum install vim bash-completion net-tools gcc -y

7、關閉swap分區:

[root@node01 ~]# swapoff -a
[root@node01 ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Thu Apr  9 01:51:58 2020
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
/dev/mapper/cl-root     /                       xfs     defaults        0 0
UUID=b5c0e84b-0644-4253-b274-e4a660c5baa3 /boot                   ext4    defaults        1 2
#/dev/mapper/cl-swap     swap                    swap    defaults        0 0
[root@node01 ~]# 

8、永久關閉防火牆:

[root@node01 ~]# systemctl stop firewalld.service
[root@node01 ~]# systemctl disable firewalld.service

9、關閉selinux:

[root@node01 ~]# setenforce 0
setenforce: SELinux is disabled
[root@node01 ~]# setenforce 0 && sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
setenforce: SELinux is disabled

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章