https://192.168.1.20:2379--etcd-cafile=http://www.mamicode.c
2. 根基环境配置
主机信息
192.168.1.19 k8s-master01 192.168.1.18 k8s-master02 192.168.1.20 k8s-master03 192.168.1.88 k8s-master-lb 192.168.1.21 k8s-node01 192.168.1.22 k8s-node02
系统环境
[[email protected] ~]# cat /etc/redhat-release CentOS Linux release 8.0.1905 (Core) [[email protected] ~]# uname -a Linux k8s-master01 4.18.0-80.el8.x86_64 #1 SMP Tue Jun 4 09:19:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
配置所有节点hosts文件
[[email protected] ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.1.19 k8s-master01 192.168.1.18 k8s-master02 192.168.1.20 k8s-master03 192.168.1.88 k8s-master-lb 192.168.1.21 k8s-node01 192.168.1.22 k8s-node02
所有节点封锁firewalld 、dnsmasq、selinux
systemctl disable --now firewalld
systemctl disable --now dnsmasq
setenforce 0
所有节点封锁swap分区
[[email protected] ~]# swapoff -a && sysctl -w vm.swappiness=0 vm.swappiness = 0
所有节点同步时间
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime echo ‘Asia/Shanghai‘ /etc/timezone ntpdate time2.aliyun.com
Master01节点生成ssh key
[[email protected] ~]# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Created directory ‘/root/.ssh‘. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: SHA256:6uz2kI+jcMJIUQWKqRcDRbvpVxhCW3Tmqn0NKS+lT3U [email protected]master01 The key‘s randomart image is: +---[RSA 2048]----+ |.o++=.o | |.+o+ + | |oo* . . | |. .* + . | |..+ + = S E | |.= o * * . | |. * * B . | | = Bo+ | | .+*oo | +----[SHA256]-----+
Master01配置免暗码登录其他节点
[[email protected] ~]# for i in k8s-master01 k8s-master02 k8s-master03 k8s-node01 k8s-node02;do ssh-copy-id -i .ssh/id_rsa.pub $i;done
所有节点安置根基工具
yum install wget jq psmisc vim net-tools yum-utils device-mapper-persistent-data lvm2 git -y
Master01下载安置文件
[[email protected] ~]# git clone https://github.com/dotbalo/k8s-ha-install.git Cloning into ‘k8s-ha-install‘... remote: Enumerating objects: 12, done. remote: Counting objects: 100% (12/12), done. remote: Compressing objects: 100% (11/11), done. remote: Total 461 (delta 2), reused 5 (delta 1), pack-reused 449 Receiving objects: 100% (461/461), 19.52 MiB | 4.04 MiB/s, done. Resolving deltas: 100% (163/163), done.
切换到1.17.x分支
git checkout manual-installation-v1.17.x
3. 根基组件安置
配置Docker yum源(和1.16.x安置法式一致)
[[email protected] k8s-ha-install]# curl https://download.docker.com/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker-ce.repo % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 2424 100 2424 0 0 3639 0 --:--:-- --:--:-- --:--:-- 3645 [[email protected] k8s-ha-install]# yum makecache CentOS-8 - AppStream 559 kB/s | 6.3 MB 00:11 CentOS-8 - Base 454 kB/s | 7.9 MB 00:17 CentOS-8 - Extras 592 B/s | 2.1 kB 00:03 Docker CE Stable - x86_64 5.8 kB/s | 20 kB 00:03 Last metadata expiration check: 0:00:01 ago on Sat 02 Nov 2019 02:46:29 PM CST. Metadata cache created.
所有节点安置新版containerd
[[email protected] k8s-ha-install]# wget https://download.docker.com/linux/centos/7/x86_64/edge/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm --2019-11-02 15:00:20-- https://download.docker.com/linux/centos/7/x86_64/edge/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm Resolving download.docker.com (download.docker.com)... 13.225.103.32, 13.225.103.65, 13.225.103.10, ... Connecting to download.docker.com (download.docker.com)|13.225.103.32|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 27119348 (26M) [binary/octet-stream] Saving to: ‘containerd.io-1.2.6-3.3.el7.x86_64.rpm’ containerd.io-1.2.6-3.3.el7.x86_64.rpm 100%[===================================================================================================================] 25.86M 1.55MB/s in 30s 2019-11-02 15:00:51 (887 KB/s) - ‘containerd.io-1.2.6-3.3.el7.x86_64.rpm’ saved [27119348/27119348] [[email protected] k8s-ha-install]# yum -y install containerd.io-1.2.6-3.3.el7.x86_64.rpm Last metadata expiration check: 0:14:35 ago on Sat 02 Nov 2019 02:46:29 PM CST.
所有节点安置最新版Docker
[[email protected] k8s-ha-install]# yum install docker-ce -y
所有节点开启Docker并设置开机自启动
温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/32799.html