Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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
languagebash
themeDJango
linenumberstrue
# 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
languagebash
themeDJango
linenumberstrue
reboot

...

Set address mapping, and test the network

Execute command

Code Block
languagebash
themeDJango
linenumberstrue
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
languagebash
themeDJango
linenumberstrue
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
languagebash
themeDJango
linenumberstrue
rm -rf /etc/yum.repos.d/* ;wget ftp://ftp.rhce.cc/k8s/* -P /etc/yum.repos.d/ ls /etc/yum.repos.d/ 

Execute screenshot

img15png img16png

1.6 Set iptables set iptables

Execute command

Code Block
languagebash
themeDJango
linenumberstrue
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

img22png

1.7 Make sure the time zone and time are correct

Execute command

Code Block
languagebash
themeDJango
linenumberstrue
timedatectl set-timezone Asia/Shanghai
systemctl restart rsyslog

Execute screenshot

img23png

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
languagebash
themeDJango
linenumberstrue
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

img24png img26png

2.2 install docker

Execute command

Code Block
languagebash
themeDJango
linenumberstrue
yum -y install docker-ce

Execute screenshot

img13png

2.3 Set docker to boot and confirm docker status

Execute command

Code Block
languagebash
themeDJango
linenumberstrue
systemctl enable docker
systemctl start docker
systemctl status docker

Execute screenshot

img12png

2.4 Configure the driver of docker's cgroup

...