If the original link installation is not successful, you can refer to my version.
sketch
Kubedm binary deploys k8s cluster. The whole deployment process is relatively cumbersome, but it is helpful for entrants to preliminarily understand k8s components, networks and other information through installation, so they still need to know.
What this article recommends is a software that can quickly deploy multi node and highly available K8S cluster: k8easy, with built-in components such as Dashboard, Prometheus, Grafana, node exporter and so on.
be careful:
1. All nodes require kernel version > 4.2
2. For all new nodes, installation resources such as installer, kubernetes-server-linux-amd64.tar.gz and pack.2020.10.02.bin should also be prepared in advance.
Other advantages are as follows:
One click installation. It only takes 3 minutes to install a system. After installation, the complete monitoring is also installed and can be used directly. (supports not only single master but also 3master high availability scheme)
The new version is released, supports 1.19.x, adds nginx ingress and helm components, and supports automatic discovery.
There is no need for configuration at all. It is completed with one click, including cluster generation.
There is no need to download any images, and all required module components are ready.
All components are installed in the system service mode, which is convenient to start and stop.
Perfect support for CentOS 7.0 and Ubuntu 16.04/18.04.
Kernel upgrade (I can only upgrade to 3.1 in this method, so I use another method) for reference
1. Upgrade the kernel offline
wget https://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-lt-5.4.107-1.el7.elrepo.x86_64.rpm wget https://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-lt-devel-5.4.107-1.el7.elrepo.x86_64.rpm yum localinstall -y kernel-lt-5.4.107-1.el7.elrepo.x86_64.rpm kernel-lt-devel-5.4.107-1.el7.elrepo.x86_64.rpm
2. Set grub kernel version
# vim /etc/default/grub GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" #Changed from saved to 0 GRUB_DEFAULT=0 GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet" GRUB_DISABLE_RECOVERY="true"
3. Recreate the kernel configuration
grub2-mkconfig -o /boot/grub2/grub.cfg
4. Restart and view the kernel
# uname -a Linux prod-166-203-252 5.4.107-1.el7.elrepo.x86_64 #1 SMP Sat Mar 20 09:47:18 EDT 2021 x86_64 x86_64 x86_64 GNU/Linux
The second kernel upgrade mode
1,View current kernel version $ uname -r 3.10.0-514.el7.x86_64 $ uname -a Linux k8s-master 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux $ cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) 2,Upgrade kernel to update yum Source warehouse $ yum -y update Enable ELRepo Warehouse ELRepo The warehouse is community-based and used at the enterprise level Linux Warehouse, providing RedHat Enterprise (RHEL) And others based on RHEL of Linux Distribution( CentOS,Scientific,Fedora Etc.). ELRepo Focus on hardware related software packages, including file system driver, graphics card driver, network driver, sound card driver and camera driver. #Import public key of ELRepo warehouse rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org #Install yum source for ELRepo warehouse rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm 3,View available system kernel packages You can see 4.4 And 4.18 Two versions yum --disablerepo="*" --enablerepo="elrepo-kernel" list available Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * elrepo-kernel: mirrors.tuna.tsinghua.edu.cn elrepo-kernel | 2.9 kB 00:00:00 elrepo-kernel/primary_db | 1.8 MB 00:00:03 Available Packages kernel-lt.x86_64 4.4.155-1.el7.elrepo elrepo-kernel kernel-lt-devel.x86_64 4.4.155-1.el7.elrepo elrepo-kernel kernel-lt-doc.noarch 4.4.155-1.el7.elrepo elrepo-kernel kernel-lt-headers.x86_64 4.4.155-1.el7.elrepo elrepo-kernel kernel-lt-tools.x86_64 4.4.155-1.el7.elrepo elrepo-kernel kernel-lt-tools-libs.x86_64 4.4.155-1.el7.elrepo elrepo-kernel kernel-lt-tools-libs-devel.x86_64 4.4.155-1.el7.elrepo elrepo-kernel kernel-ml.x86_64 4.18.7-1.el7.elrepo elrepo-kernel kernel-ml-devel.x86_64 4.18.7-1.el7.elrepo elrepo-kernel kernel-ml-doc.noarch 4.18.7-1.el7.elrepo elrepo-kernel kernel-ml-headers.x86_64 4.18.7-1.el7.elrepo elrepo-kernel kernel-ml-tools.x86_64 4.18.7-1.el7.elrepo elrepo-kernel kernel-ml-tools-libs.x86_64 4.18.7-1.el7.elrepo elrepo-kernel kernel-ml-tools-libs-devel.x86_64 4.18.7-1.el7.elrepo elrepo-kernel perf.x86_64 4.18.7-1.el7.elrepo elrepo-kernel python-perf.x86_64 4.18.7-1.el7.elrepo elrepo- 4,Install the latest kernel version $ yum --enablerepo=elrepo-kernel install kernel-ml --enablerepo Option on CentOS The specified warehouse on the system. It is enabled by default elrepo,Used here elrepo-kernel Replace. 5,set up grub2 After the kernel is installed, it needs to be set as the default startup option and restarted before it takes effect View all available cores on the system: $ sudo awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg 0 : CentOS Linux (4.18.7-1.el7.elrepo.x86_64) 7 (Core) 1 : CentOS Linux (3.10.0-862.11.6.el7.x86_64) 7 (Core) 2 : CentOS Linux (3.10.0-514.el7.x86_64) 7 (Core) 3 : CentOS Linux (0-rescue-063ec330caa04d4baae54c6902c62e54) 7 (Core) Set the new kernel to grub2 Default version of There are four cores on the server. We want to use 4.18 This version can be grub2-set-default 0 Command or edit /etc/default/grub File to set Method 1. Pass grub2-set-default 0 Command settings Where 0 is the available kernel found above grub2-set-default 0 Method 2. Edit /etc/default/grub file set up GRUB_DEFAULT=0,The kernel with number 0 displayed by the above query is used as the default kernel: $ vim /etc/default/grub GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=0 GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=cl/root rhgb quiet" GRUB_DISABLE_RECOVERY="true" generate grub Profile and restart $ grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-4.18.7-1.el7.elrepo.x86_64 Found initrd image: /boot/initramfs-4.18.7-1.el7.elrepo.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-862.11.6.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-862.11.6.el7.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-514.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-514.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-063ec330caa04d4baae54c6902c62e54 Found initrd image: /boot/initramfs-0-rescue-063ec330caa04d4baae54c6902c62e54.img done $ reboot 6,verification $ uname -r 4.18.7-1.el7.elrepo.x86_64 kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Cluster deployment
1. Download k8seasy components
wget http://dl.k8seasy.com/installer wget http://dl.k8seasy.com/kubernetes-server-linux-amd64.tar.gz wget http://dl.k8seasy.com/pack.2020.10.02.bin
Of which:
installer is the installation tool.
kubernetes-server-linux-amd64.tar.gz can be downloaded from the official website and must be an AMD64 platform.
pack.2020.10.02.bin is the image file.
2. Create key
If an error is reported, the file should have no permission. Add a permission to it
chmod installer 777
./installer --genkey -hostlist=10.166.203.252
3. Create a cluster
#If there are multiple master s, you can use the following command ./installer -kubernetestarfile kubernetes-server-linux-amd64.tar.gz -masterip 10.166.203.252,10.166.203.253,10.166.203.254 # Single master ./installer -kubernetestarfile kubernetes-server-linux-amd64.tar.gz -masterip 10.166.203.252 # The following is the print information of the single master deployment process master: 10.166.203.252 IP: 10.166.203.252 Eth: ens192 1> Upgrade system. 2> Install etcd. 3> Install flanneld. 4> Install haproxy. 5> Update kubernets env. 6> Install K8S API Server. 7> Install K8S Controller Server. 8> Install K8S Scheduler Server. 9> Install Docker. ............... 10> Update Kubeadm env. 11> Install kubelet. 12> Install K8S Proxy. 13> Install coredns. 14> Install monitoring & dashboard. 15> Install Helm. 16> Install nginx-ingress. 17> Install localwebproxy. Please use your browser to access alertmanager http://10.166.203.252:8080 Please use your browser to access grafana http://10.166.203.252:8081 default user name admin default password admin Please use your browser to access prometheus http://10.166.203.252:8082 Please use your browser to access node_export http://10.166.203.252:9100 Please use your browser to access dashboard http://10.166.203.252:10000 You can find more detail about alertmanager by visiting http://10.166.203.252:8080 You can find more detail about grafana by visiting http://10.166.203.252:8081 the default user: admin pass: admin You can find more detail about prometheus by visiting http://10.166.203.252:8082 You can find more detail about node_export by visiting http://10.166.203.252:9100 You can find more detail about dashboard by visiting http://10.166.203.252:10000 18> Install localwebproxy. A configuration file has been copied lens.kubeconfig In the current directory, this configuration file can be used by various management tools (such as lens) Direct use Please in /etc/hosts Add the following contents to the document 10.166.203.252 s7400036261.lens.k8seasy.com Of which 10.166.203.252 For native IP, It can also be a local computer directly accessible by any management tool IP (If the machine has multiple ip You can choose any one K8Seasy is a tools that can help you quickly deploy Kubernetes clusters to local and cloud environmental. K8S version: 1.11.3-1.18 installer version: 1.0.0.004 Packfile version: 2020.10.02.001 Packfile: pack.2020.10.02.bin Packfile md5sum: 06222ec7e9dfd17efe318e94540c019d Build Time: Git Hash: Website: http://www.k8seasy.com https://github.com/xiaojiaqi/k8seasy_release_page Feature Request/Bug Report Form: https://github.com/xiaojiaqi/k8seasy_release_page/issues Email: k8seasy@gmail.com License: Personal non-commercial use. License cannot be used either directly or indirectly for business purposes.
From the service, you can see that dashboard, alertmanager, grafana and node exporter have been built in.
5. Add a new node
#Copy key to new node cp ../k8skey.pem ./ #Join the machine to the cluster ./installer -kubernetestarfile kubernetes-server-linux-amd64.tar.gz -masterip 10.166.203.252 #If there are multiple master clusters, you can use the following command to join the cluster ./installer -kubernetestarfile kubernetes-server-linux-amd64.tar.gz -masterip 10.166.203.252,10.166.203.253,10.166.203.254
Note: installation resources such as installer, kubernetes-server-linux-amd64.tar.gz and pack.2020.10.02.bin should also be prepared in advance for the new node.
6. One click unloading
# ./installer -uninstall 1> uninstall kube-apiserver 2> uninstall kube-controller-manager 3> uninstall kube-proxy 4> uninstall kube-scheduler 5> uninstall kubelet 6> uninstall flanneld 7> uninstall haproxy 8> uninstall docker 9> uninstall etcd 10> uninstall localwebproxy It's done.