Technical note

K8S离线部署笔记-7-NTP服务

所有主机

# 安装
yum install -y ntp

# 启用服务 
systemctl start ntpd
systemctl enable ntpd

服务端

# 修改配置
vi /etc/ntp.conf
#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 127.127.1.0 
fudge  127.127.1.0 stratum 0

# 重启服务 
systemctl restart ntpd

# 查看状态
ntpq -p
ntpstat

客户端

# 修改配置
vi /etc/ntp.conf
#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 10.10.51.77
fudge 10.10.51.77 stratum 0
restrict 10.10.51.77 nomodify notrap noquery

# 重启服务 
systemctl restart ntpd

# 手工同步时间
ntpdate -u 10.10.51.77

# 查看状态
ntpq -p
ntpstat