k8s learning (1) - Preface

Division of cluster network segments

1. Host node network segment
192.168.1.0/24
2. Service network segment
service is the proxy of pod, and service is used for cluster container communication.
10.96.0.0/16
3, Pod network segment, which is equivalent to the IP of the container
Pod is a collection of containers
10.244.0.0/16 The three
network segments cannot be duplicated and conflicted

It can be calculated by online IP address/subnet mask calculation and conversion tool :

Therefore, the general recommendation is not to repeat the first one. For example, if your host machine starts with 192, then your service can be 10.96.0.0/12. If your host machine starts with 10, just
directly Change the service network segment to 192.168.0.0/16
If your host starts with 172, directly change the pod network segment to 192.168.0.0/12

Pay attention to the collocation. They are all collocations of 10 network segments, 172 network segments, and 192 network segments. The first number at the beginning is different to avoid the possibility of network segment conflicts, and the calculation steps can also be subtracted.

Cluster resource configuration (high availability)

1. Learning environment (for k8s basic learning)

a)	2核2G 磁盘40G足矣,可以采用单master多Node,或者多Master无Node(Master节点也可以充当Node节点)

2. Actual combat environment (for k8s actual combat learning, starting from the advanced part)

a)	2核4G+磁盘40G+40G,可以采用单Master多Node,
    或者多Master多Node(Master节点也可以充当Node节点,总计可用node节点数为5即可)

3. Enterprise test environment:

a)	Master节点(尽量三台实现高可用,可以将某台Master禁止调度):8核16G+ 磁盘分为系统盘(路径:/,大小100G+)、Docker数据盘(/var/lib/docker,200G+)
b)	Etcd数据盘(/var/lib/etcd,50节点50G+,150节点150G+,etcd节点可以和Master节点同一个宿主机,三个节点实现高可用)
c)	Node节点:无特殊要求
d)	注意:测试环境所有的数据盘可以无需区分,有条件最好单独

4. Enterprise production environment:

a)	Master节点:三个节点实现高可用(必须)
    i.	节点数:0-100    8核16+
    ii.	节点数:100-250  8核32G+
    iii.	节点数:250-500  16核32G+
b)	etcd节点:三个节点实现高可用(必须),有条件存储分区必须高性能SSD硬盘,没有SSD也要有高效独立磁盘
    i.	节点数:0-50    2核8G+   50G SSD存储
    ii.	节点数:50-250  4核16G+  150G SSD存储
    iii.	节点数:250-1000  8核32G+ 250G SSD存储
c)	Node节点:无特殊要求,主要是Docker数据分区、系统分区需要单独使用,不可以使用同一个磁盘,系统分区100G+、Docker数据分区200G+,有条件使用SSD硬盘,必须独立于系统盘
d)	其他:集群规模不大可以将etcd和master放置于同一个宿主机,
    也就是每个master节点部署k8s组件和etcd服务,但是etcd的数据目录一定要独立,并且使用SSD,
    两者部署在一起需要相对增加宿主机的资源,个人建议生产环境把master节点的资源一次性给够,
    此处的费用不应该节省,可以直接使用16核32G或者64G的机器,之后集群扩容就无需扩容master节点的资源,减少风险。
    其中master节点和etcd节点的系统分区100G即可。

Precautions

Version selection, the third version number is greater than 5 (such as 1.23.6)
insert image description here

Guess you like

Origin blog.csdn.net/weixin_44831720/article/details/125435149