Kubernetes1.18实践及踩坑(之一)配置CentOS

6 篇文章 0 订阅
6 篇文章 0 订阅

手头有3台服务器master01, node01, node02

注:以下配置过程在3台机器上都要执行。

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、修改主机名:

分别在3台机器上分别执行:

[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
192.168.100.207 node02.huiyan.com node02

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 ~]# sed -ri 's/.*swap.*/#&/' /etc/fstab
[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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值