K8s介绍及离线安装(二)

K8s介绍及离线安装(二)

一、离线实验环境

示例:使用vm虚拟机,硬件配置:2核2G40G虚拟机三台

机器名IP地址
offline-k8s01172.30.161.85
offline-k8s02172.30.161.86
offline-k8s03172.30.161.87

二、通用基础设置

1.通用基础操作设置

#各个机器设置自己的域名
hostnamectl set-hostname xxxx
# 将 SELinux 设置为 permissive 模式(相当于将其禁用)
sudo setenforce 0
sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
#关闭swap
swapoff -a  
sed -ri 's/.*swap.*/#&/' /etc/fstab
#关闭防火墙
systemctl stop firewalld
systemctl disable firewalld

2.安装ntp时间同步

offline-k8s01设为master

yum -y install ntp  && systemctl enable ntpd && systemctl start ntpd
vi /etc/ntp.conf
# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 172.30.161.85 nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 127.127.1.0
Fudge 127.127.1.0 stratum 10

其余两台机器offline-k8s02,offline-k8s03都需安装ntp,并且和offline-k8s01同步

yum -y install ntp  && systemctl enable ntpd && systemctl start ntpd
vi /etc/ntp.conf
# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 172.30.161.86 nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1

# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
restrict 172.30.161.254 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 172.30.161.85
Fudge 172.30.161.85 stratum 10

过5分钟检查是否同步

ntpstat
synchronised to unspecified (172.30.161.85) at stratum 7
   time correct to within 280 ms
   polling server every 1024 s

3.每台机器host新增

echo "172.30.161.85 offline-k8s01 k8s1.com" >> /etc/hosts
或者
vi /etc/hosts
172.30.161.85 offline-k8s01 k8s1.com
172.30.161.86 offline-k8s02 k8s2.com
172.30.161.87 offline-k8s03 k8s3.com

4.ssh免密登录

ssh-keygen -t rsa #一路回车
ssh-copy-id 172.30.161.85 #yes后输入密码
ssh-copy-id 172.30.161.86 #yes后输入密码
ssh-copy-id 172.30.161.87 #yes后输入密码

总结

例如:以上就是基础的linux设置,下一篇离线安装docker。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值