第148天学习打卡(Kubernetes kubeadm init 成功部署 部署网络插件 部署容器化应用)
c3j9i2htclj6thlta6Z ~]# clear
[root@iZ2vc3j9i2htclj6thlta6Z ~]# systemctl stop firewalld
[root@iZ2vc3j9i2htclj6thlta6Z ~]# systemctl disable firewalld
[root@iZ2vc3j9i2htclj6thlta6Z ~]# sed -i 's/enforcing/disabled/' /etc/selinux/config
[root@iZ2vc3j9i2htclj6thlta6Z ~]# setenforce 0
setenforce: SELinux is disabled
[root@iZ2vc3j9i2htclj6thlta6Z ~]# swapoff -a
[root@iZ2vc3j9i2htclj6thlta6Z ~]# sed -ri 's/.*swap.*/#&/' /etc/fstab
[root@iZ2vc3j9i2htclj6thlta6Z ~]# hostnamectl set-hostname master
[root@iZ2vc3j9i2htclj6thlta6Z ~]# hostname
master
#这一步只在master节点执行
[root@iZ2vc3j9i2htclj6thlta6Z ~]# cat >> /etc/hosts << EOF
> 阿里云公网ip master
> 阿里云公网ip node01
> 阿里云公网ip node02
> 阿里云公网ip node03
> EOF
[root@iZ2vc3j9i2htclj6thlta6Z ~]# cat > /etc/sysctl.d/k8s.conf << EOF
> net.bridge.bridge-nf-call-ip6tables = 1
> net.bridge.bridge-nf-call-iptables = 1
> EOF
[root@iZ2vc3j9i2htclj6thlta6Z ~]# sysctl --system
[root@iZ2vc3j9i2htclj6thlta6Z ~]# yum install ntpdate -y
[root@iZ2vc3j9i2htclj6thlta6Z ~]# ntpdate time.windows.com
5 Jun 15:35:49 ntpdate[1580]: adjust time server 52.231.114.183 offset -0.003727 sec
[root@iZ2vc3j9i2htclj6thlta6Z ~]# sysctl --system
[root@iZ2vc3j9i2htclj6thlta6Z ~]# yum -y install gcc
[root@iZ2vc3j9i2htclj6thlta6Z ~]#yum -y install gcc-c++
[root@iZ2vc3j9i2htclj6thlta6Z ~]# systemctl status chronyd
● chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2021-06-05 15:16:23 CST; 22min ago
Docs: man:chronyd(8)
man:chrony.conf(5)
Main PID: 565 (chronyd)
CGroup: /system.slice/chronyd.service
└─565 /usr/sbin/chronyd
Jun 05 15:16:23 AliYun systemd[1]: Starting NTP client/server...
Jun 05 15:16:23 AliYun chronyd[565]: chronyd version 3.4 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +SECHASH +IPV6 +DEBUG)
Jun 05 15:16:23 AliYun chronyd[565]: Frequency -32.455 +/- 0.741 ppm read from /var/lib/chrony/drift
Jun 05 15:16:23 AliYun systemd[1]: Started NTP client/server.
Jun 05 15:17:01 iZ2vc3j9i2htclj6thlta6Z chronyd[565]: Selected source 100.100.61.88
Jun 05 15:17:01 iZ2vc3j9i2htclj6thlta6Z chronyd[565]: System clock wrong by 0.760561 seconds, adjustment started
[root@iZ2vc3j9i2htclj6thlta6Z ~]# systemctl restart chronyd
[root@iZ2vc3j9i2htclj6thlta6Z ~]# cat /etc/chrony.conf
[root@iZ2vc3j9i2htclj6thlta6Z ~]# free -m
total used free shared buff/cache available
Mem: 7551 139 6635 0 776 7172
Swap: 0 0 0
[root@iZ2vc3j9i2htclj6thlta6Z ~]# cd /usr/lib/modules
[root@iZ2vc3j9i2htclj6thlta6Z modules]# ls
3.10.0-1127.19.1.el7.x86_64 3.10.0-1127.el7.x86_64
[root@iZ2vc3j9i2htclj6thlta6Z modules]# uname -r
3.10.0-1127.19.1.el7.x86_64
[root@iZ2vc3j9i2htclj6thlta6Z modules]# cd 3.10.0-1127.19.1.el7.x86_64/
[root@iZ2vc3j9i2htclj6thlta6Z 3.10.0-1127.19.1.el7.x86_64]# ls
build kernel modules.alias.bin modules.builtin modules.dep modules.devname modules.modesetting modules.order modules.symbols source vdso
extra modules.alias modules.block modules.builtin.bin modules.dep.bin modules.drm modules.networking modules.softdep modules.symbols.bin updates weak-updates
[root@iZ2vc3j9i2htclj6thlta6Z 3.10.0-1127.19.1.el7.x86_64]# cd kernel/
[root@iZ2vc3j9i2htclj6thlta6Z kernel]# ls
arch crypto drivers fs kernel lib mm net sound virt
[root@iZ2vc3j9i2htclj6thlta6Z kernel]# ls
arch crypto drivers fs kernel lib mm net sound virt
[root@iZ2vc3j9i2htclj6thlta6Z kernel]# cd net/
[root@iZ2vc3j9i2htclj6thlta6Z net]# ls
6lowpan 8021q bluetooth can core dns_resolver ipv4 key llc mac802154 netlink packet rfkill sctp unix wireless
802 atm bridge ceph dccp ieee802154 ipv6 l2tp mac80211 netfilter openvswitch psample sched sunrpc vmw_vsock xfrm
[root@iZ2vc3j9i2htclj6thlta6Z net]# cd netfilter/
[root@iZ2vc3j9i2htclj6thlta6Z netfilter]# ls
[root@iZ2vc3j9i2htclj6thlta6Z netfilter]# cd ipvs
[root@iZ2vc3j9i2htclj6thlta6Z ipvs]# pwd
/usr/lib/modules/3.10.0-1127.19.1.el7.x86_64/kernel/net/netfilter/ipvs
[root@iZ2vc3j9i2htclj6thlta6Z ipvs]# ls
ip_vs_dh.ko.xz ip_vs.ko.xz ip_vs_lblcr.ko.xz ip_vs_nq.ko.xz ip_vs_rr.ko.xz ip_vs_sh.ko.xz ip_vs_wrr.ko.xz
ip_vs_ftp.ko.xz ip_vs_lblc.ko.xz ip_vs_lc.ko.xz ip_vs_pe_sip.ko.xz ip_vs_sed.ko.xz ip_vs_wlc.ko.xz
[root@iZ2vc3j9i2htclj6thlta6Z ipvs]# cd ..
[root@iZ2vc3j9i2htclj6thlta6Z netfilter]# cd ..
[root@iZ2vc3j9i2htclj6thlta6Z net]# cd ..
[root@iZ2vc3j9i2htclj6thlta6Z kernel]# cd ..
[root@iZ2vc3j9i2htclj6thlta6Z 3.10.0-1127.19.1.el7.x86_64]# cd ..
[root@iZ2vc3j9i2htclj6thlta6Z modules]# cd ..
[root@iZ2vc3j9i2htclj6thlta6Z lib]# cd ..
[root@iZ2vc3j9i2htclj6thlta6Z usr]# cd ..
[root@iZ2vc3j9i2htclj6thlta6Z /]# wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
[root@iZ2vc3j9i2htclj6thlta6Z /]# yum install docker-ce-20.10.7 -y
[root@iZ2vc3j9i2htclj6thlta6Z /]# sudo mkdir -p /etc/docker
[root@iZ2vc3j9i2htclj6thlta6Z /]# sudo tee /etc/docker/daemon.json <<-'EOF'
> {
> "registry-mirrors": ["https://g6yrjrwf.mirror.aliyuncs.com"]
> }
> EOF
{
"registry-mirrors": ["https://g6yrjrwf.mirror.aliyuncs.com"]
}
[root@iZ2vc3j9i2htclj6thlta6Z /]# sudo systemctl daemon-reload
[root@iZ2vc3j9i2htclj6thlta6Z /]# sudo systemctl restart docker
[root@iZ2vc3j9i2htclj6thlta6Z /]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://g6yrjrwf.mirror.aliyuncs.com"]
}
[root@iZ2vc3j9i2htclj6thlta6Z /]#
# 配置镜像加速器(这个是上面的操作 把这个全部复制然后去Xhsell里面粘贴就可以了)
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'