...
If the name is long, it is recommended to use a combination of letters and dashes, such as "aa-bb-cc", here directly set to master and worker1
Execute command
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# master hostnamectl set-hostname master hostnamectl # worker hostnamectl set-hostname worker1 hostnamectl |
Execute screenshot
The changed host name needs to take effect after reboot
Execute command
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
reboot |
...
Set address mapping, and test the network
Execute command
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
cat <<EOF>> /etc/hosts ${YOUR IP} master ${YOUR IP} worker1 EOF ping master ping worker1 |
Execute screenshot
1.4 Turn off firewall, selinux and swap
Execute command
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
systemctl stop firewalld systemctl disable firewalld setenforce 0 sed -i "s/^SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config swapoff -a sed -i 's/.*swap.*/#&/' /etc/fstab |
Execute screenshot
1.5 Download the new yum source
Execute command
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
rm -rf /etc/yum.repos.d/* ;wget ftp://ftp.rhce.cc/k8s/* -P /etc/yum.repos.d/ ls /etc/yum.repos.d/ |
Execute screenshot
1.6 Set iptables set iptables
Execute command
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
cat <<EOF> /etc/sysctl.d/k8s.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 net.ipv4.ip_forward = 1 EOF sysctl -p /etc/sysctl.d/k8s.conf |
Execute screenshot
1.7 Make sure the time zone and time are correct
Execute command
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
timedatectl set-timezone Asia/Shanghai systemctl restart rsyslog |
Execute screenshot
2 Install docker
Both master node and worker node need to execute. The main content is to install docker, and configure the cgroup driver of docker as systemd, confirm the driver
2.1 uninstall old docker
Execute command
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
yum -y remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine docker-ce docker-ce-cli |
Execute screenshot
2.2 install docker
Execute command
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
yum -y install docker-ce |
Execute screenshot
2.3 Set docker to boot and confirm docker status
Execute command
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
systemctl enable docker systemctl start docker systemctl status docker |
Execute screenshot
2.4 Configure the driver of docker's cgroup
...