kubesphere / kubekey

Install Kubernetes/K3s only, both Kubernetes/K3s and KubeSphere, and related cloud-native add-ons, it supports all-in-one, multi-node, and HA 🔥 ⎈ 🐳
https://kubesphere.io
Apache License 2.0
2.37k stars 551 forks source link

Initialize operating system process optimization #1787

Open pixiake opened 1 year ago

pixiake commented 1 year ago

Currently, the main steps in the operating system initialization process include:

  1. Kernel parameter configuration
  2. /etc/hosts configuration

https://github.com/kubesphere/kubekey/blob/master/cmd/kk/pkg/bootstrap/os/templates/init_script.go

To ensure that each nodes in the cluster contain the hosts configuration of other nodes, all nodes will execute the operating system initialization script before adding a new node.

This approach can lead to adding nodes failures due to issues such as existing nodes being unable to connect.

Therefore, it is necessary to optimize the current logic.

One solution is to only perform the operating system initialization process on the new nodes to be added before adding to cluster, and then synchronize the latest hosts configuration to the other nodes in the cluster after the nodes has been added. This approach can help to avoid adding node failures in emergency situations.

The same issue: https://github.com/kubesphere/kubekey/issues/1638

shihaoH commented 11 months ago

What configuration information needs to be synchronized to other nodes after adding a node?

shihaoH commented 11 months ago

Is it only necessary to synchronize the /etc/hosts file?