The present invention provides a method and
system for improving the node
resource utilization rate of Kubernetes and balancing the load, comprising: step S1: obtaining the kube-apiserver version supported by the cluster through configuration creation of a
client connected to the cluster, and judging whether the cluster supports expulsion; step S2: the verified cluster
client creates a sharedInformerFactory, registers informers of nodes, pods, and namespaces resources to the sharedInformerFactory to obtain
relevant information of the cluster; step S3: using a pod selector component to filter out pods for dynamic distribution adjustment; step S4: based on the filtered pods capable of dynamic distribution adjustment, obtaining a mapping relationship of pod-node; step S5: executing strategies in sequence according to a configuration file according to the obtained mapping relationship of pod-node, thereby obtaining an expulsion and reconstruction result; step S6: rebuilding the pod, and the cluster scheduler kube-scheduler redeploys the reconstructed pod to a preset node; performing cyclic monitoring according to the interval interval in the configuration parameter, repeatedly triggering steps S3 to S6, and dynamically adjusting the pod distribution in the cluster, thereby balancing the cluster load and adjusting the balance.