Deploy a complete K8S cluster (part I)
Note: The red characters are the contents that need to be entered in the shell:
Machine planning:
Turn it on, turn it off automatically.
[root@k8s-etcd1 ~]# systemctl disable firewalld.service
turn off the firewall
[root@k8s-etcd1 ~]# systemctl stop firewalld.service
Scheduled Task Synchronization Time:
0 */1 * * * /usr/sbin/ntpdate cn.pool.ntp.org > /dev/null 2>&1
Close selinux
[root@k8s-etcd1 ~]# sed -i "s#SELINUX=enforcing#SELINUX=disabled#g" /etc/selinux/config
[root@k8s-etcd1 ~]# sed -i "s#SELINUX=enforcing#SELINUX=disabled#g" /etc/sysconfig/selinux
Change host name
[root@k8s-etcd1 ~]# hostnamectl set-hostname k8s-etcd1
synchronization time
[root@k8s-etcd1 ~]# sudo timedatectl set-timezone Asia/Shanghai
[root@k8s-etcd1 ~]# date
[root@k8s-etcd1 ~]# sudo timedatectl set-local-rtc 0
[root@k8s-etcd1 ~]# sudo systemctl restart rsyslog
[root@k8s-etcd1 ~]# sudo systemctl restart crond
Close swap partition
[root@k8s-etcd1 ~]# sudo swapoff -a
[root@k8s-etcd1 ~]# free -m
total used free shared buff/cache available
Mem: 3770 136 3510 11 124 3449
Swap: 0 0 0 Confirm swap partition is closed
Switch partition off automatically
[root@k8s-etcd1 ~]# sudo sed -i '/ swap / s/^\(.*\)$/#\ 1/g' /etc/fstab
Resolve hosts to hosts file
[root@k8s-etcd1 ~]# cat >> /etc/hosts