In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the knowledge of "how to build a Kubernetes cluster". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Kubernetes is a portable, extensible, open source platform for managing containerized workloads and services that facilitate declarative configuration and automation. Kubernetes has a large and fast-growing ecosystem, and Kubernetes's services, support, and tools are widely available.
I. preparatory work
The best way to build a cluster is to buy a few CVMs, which are very comfortable to build, of course, if funds permit! If you don't have enough money, just build a virtual machine like me.
Because it is a virtual machine, the performance of the computer is average, I build here is a single node, please know ~
Basic environment
The following are the environmental requirements of my experiment
2-core 2G server 20g disk centos7 server interworking between intranets can access the Internet scientifically
One more thing here, before the deployment of this thing, my server can access the Internet scientifically, and the deployment process is simply not too smooth. However, in order to show you, I specially wrote an article about the general use of the domestic environment, and the process is quite difficult.
II. Start deployment
For convenience, the following operations are performed under the root user
1. Equipped with yum source
What I use here is Aliyun's yum source to back up the previous one before configuring the yum source.
Root@localhost ~] # cd / etc/yum.repos.d/ [root@localhost yum.repos.d] # ll total consumption is 32m / r / r. 1 root root 1664 September 5 21:05 CentOS-Base.repo-rw-r--r--. 1 root root 1309 September 5 21:05 CentOS-CR.repo-rw-r--r--. 1 root root 649 September 5 21:05 CentOS-Debuginfo.repo-rw-r--r--. 1 root root 314 September 5 21:05 CentOS-fasttrack.repo-rw-r--r--. 1 root root 630 September 5 21:05 CentOS-Media.repo-rw-r--r--. 1 root root 1331 September 5 21:05 CentOS-Sources.repo-rw-r--r--. 1 root root 6639 September 5 21:05 CentOS-Vault.repo [root@localhost yum.repos.d] # mkdir bak [root@localhost yum.repos.d] # mv * bakmv: the directory "bak" cannot be moved to its own subdirectory "bak/bak" under [root@localhost yum.repos.d] # ll Total usage 0drwxr-xr-x. 2 root root 187January 10 11:17 bak
Configure yum Feed
[root@localhost yum.repos.d] # curl-o / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo% Total% Received% Xferd Average Speed Time Current Dload Upload Total Spent Left Speed100 2523 2523 00 23632 0 -::-23801
Configure kubernetes Feed
Cat / etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetesbaseurl= https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/enabled=1gpgcheck=1repo_gpgcheck=1gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpgEOF
Configure docker Feed
[root@localhost yum.repos.d] # yum install-y yum-utils device-mapper-persistent-data lvm2 [root@localhost yum.repos.d] # yum-config-manager-add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Generate cach
[root@localhost yum.repos.d] # yum clean all [root@localhost yum.repos.d] # yum makecache
Close the swap partition
The reasons are as follows:
Kubernetes is about wrapping the instance as closely as possible. All deployments should be pinned to the CPU / memory limit. So if the scheduler sends a pod to a machine, it should not use swapping. The designer doesn't want to swap because it slows down. So turning off swap is mainly for performance considerations.
[root@localhost yum.repos.d] # swapoff-a [root@localhost yum.repos.d] # vim / etc/fstab # Don't bother to write sed just read it ~ comment out this line: / dev/mapper/centos-swap swap
Write kubernetes configuration
[root@localhost yum.repos.d] # vim / etc/sysctl.d/k8s.confnet.bridge.bridge-nf-call-ip6tables = 1net.bridge.bridge-nf-call-iptables = 1 vm.swappiness=0
Load configuration
Sysctl-system
Turn off seliunx and firewall
[root@localhost yum.repos.d] # setenforce 0 [root@localhost yum.repos.d] # systemctl disable firewalld [root@localhost yum.repos.d] # systemctl stop firewalld [root@localhost yum.repos.d] # sed-I's bound for etc/selinux/config
Enable routing forwarding
[root@localhost yum.repos.d] # sysctl-w net.ipv4.ip_forward=1# by default, linux disables route forwarding for security reasons, that is, more than one network card on the same machine transfers packets from one network card to another, and allows another network card to continue routing, that is, to realize the communication between hosts of two different network segments. The IP of service is routed through proxy (that is, kube-proxy or kube-router) and does not require the participation of the router. When the node receives the packet, the destination IP of the packet is the local private network IP,proxy. The destination IP of the packet is converted into Service IP, routed and forwarded to the virtual network card of the corresponding network segment of Serive IP, and finally routed to the correct Pod. "how to build Kubernetes cluster" is introduced here. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.