Get the App
SLTechnology News&Howtos  ›  Servers  › 

Best practices for kubeadm installation of Kubernetes

Shulou Source: shulou.com Published: 2022-06-03 02:36:33 09月22日 Update

preface

Kubernetes is popular as a container orchestration tool to simplify container management and improve productivity. A lot of newbies deploy Kubernetes due to "Section. learn. on. The problem of "net" is difficult. This article explains kubeadm in detail with actual combat experience. learn. on. Web "The easiest way to deploy Kubernetes.

1. Introduction to Kubernetes

Kubernetes (referred to as K8S) is an open source container cluster management system, which can realize automatic deployment, automatic capacity expansion and maintenance of container clusters. It is both a container orchestration tool and a new leading solution for container-based distributed architecture. Based on Docker technology, it provides deployment, resource scheduling, service discovery and dynamic scaling functions for containerized applications, improving the convenience of large-scale container cluster management.

There are two types of K8S cluster: management node and worker node. The management node is mainly responsible for K8S cluster management, information interaction and task scheduling among nodes in the cluster, and is also responsible for lifecycle management of containers, pods, NameSpaces, PV, etc. Worker nodes mainly provide computing resources for containers and pods. Pods and containers all run on worker nodes. Worker nodes communicate with management nodes through kubelet services to manage the lifecycle of containers and communicate with other nodes in the cluster.

II. Environmental preparation

Kubernetes supports running in physical servers or virtual machines. This time, virtual machines are used to prepare the test environment. The hardware configuration information is shown in the table:

IP Address Node Role CPUMemoryHostname Disk 10.10.10master>=2c>= 2Gmastersda10.10.11worker>=2c>= 2Gnode1sda10.10.12worker>=2c>= 2Gnode2sda

Note: Do the following on all nodes

1. Set the hostname, and the admin node sets the hostname to master.

hostnamectl set-hostname master

If you need to set other host names, replace master with the correct host names node1 and node2.

2. Edit the/etc/hosts file to add domain name resolution.

cat /etc/hosts10.10.10.10 master10.10.10.11 node110.10.10.12 node2EOF

3. Turn off firewall, selinux and swap.

systemctl stop firewalldsystemctl disable firewalldsetenforce 0sed -i "s/^SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/configswapoff -ased -i 's/.* swap.*/#&/ ' /etc/fstab

4. Configure kernel parameters to pass bridged IPv4 traffic to the chain of iptables

cat > /etc/sysctl.d/k8s.conf

Tags: Node cluster container management configuration run address tool status work service host content technology information cycle command life resource communication Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Apple OPPO Reno Redmi Microsoft