Dual-stack K8S cluster implementation method based on IPV4 and IPV6

By configuring IPV4 and IPV6 virtual IP addresses and deploying Calico network components in the K8S cluster, the business needs of IPV4/IPV6 mixed deployment during the IPV6 migration process of the K8S container cluster are solved, achieving high availability and load balancing, and adapting to the future IPV6 protocol. Stack conversion.

CN118740801APending Publication Date: 2024-10-01HENAN SPLENDOR SCI & TECH
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410692030.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

The existing K8S container cluster has business requirements for IPV4/IPV6 mixed deployment during the IPV6 migration process, and the comprehensive video surveillance system has high requirements for high availability, load balancing, performance and network consistency, which are difficult to effectively solve with existing technologies. these questions.

Method used

Adopting the dual-stack K8S cluster implementation method based on IPV4 and IPV6, by compiling and installing the load proxy component Nginx and the high-availability component keepalived on the master node of the K8S cluster, configure the IPV4 and IPV6 virtual IP addresses, and deploy the network component Calico in the cluster To support the IPV4/IPv6 dual-stack protocol, the application microservice POD can communicate with external devices based on the virtualized IPV4 and IPV6 virtual IP addresses.

Benefits of technology

It realizes K8S cluster's support for IPV4/IPV6 mixed deployment, meets high availability and load balancing requirements, expands the application scope of the cluster, and adapts to future IPV6 protocol stack conversion needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118740801A_ABST
    Figure CN118740801A_ABST
Patent Text Reader

Abstract

The invention provides a dual-stack K8S cluster implementation method based on IPV4 and IPV6, and the method comprises the steps: constructing a K8S cluster, and compiling and installing a load agent component Nginx on a master node of the K8S cluster; a high-availability component keepalived is compiled and installed on a master node of the K8S cluster, and a configuration file of the high-availability component keepalived is modified, so that an IPV6 virtual IP address and an IPV4 virtual IP address are configured at the same time; the high-availability component keepalived is started, and an IPV4 virtual IP address and an IPV6 virtual IP address corresponding to an application micro-service POD are virtualized respectively; the method comprises the following steps: deploying a network component Calico in a K8S cluster, and enabling the network component Calico to support an IPV4 / IPV6 dual-stack protocol; deploying an application micro-service POD on a Node node of the K8S cluster; wherein the application micro-service POD is used for communicating and interconnecting with external equipment based on the virtualized IPV4 virtual IP address and the virtualized IPV6 virtual IP address, so as to realize corresponding service functions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of K8S container clusters, and in particular to a method for implementing a dual-stack K8S cluster based on IPV4 and IPV6. Background Art

[0002] K8S (short for Kubernetes) is a mainstream container orchestration platform that has been widely used. The current deployment solution is mainly based on the K8S+DOCKER mode of the IPV4 single protocol stack. At this stage, IPV4 IP address resources are almost exhausted, and all applications will gradually migrate to the IPV6 protocol stack in the future. K8S version 1.24 has begun to decouple from Docker (open source application container engine) and instead uses Containerd (industrial standard container runtime) with better support for IPV6 as the default container runtime. However, it will take some time for each business application to migrate to IPV6. It is still in the transition stage of gradually migrating from IPV4 to IPV6, and the business demand for IPV4 / IPV6 mixed deployment will exist for a long time.

[0003] Against the above background, the "Technical Specifications for Railway Integrated Video Surveillance Systems" (Q / CR 575-2022) released in 2022 also timely added the requirement to support IPV6, that is, the regional nodes located in the middle layer must not only communicate with the upper-layer core nodes via IPV6, but also support IPV4 / IPV6 dual-stack hybrid communication with the lower-layer video access nodes (considering that the IPV6 transformation of a large number of visual access nodes from different manufacturers cannot be achieved overnight, dual-stack application scenarios may exist for a long time).

[0004] It should be noted that since comprehensive video surveillance places high demands on the platform's high availability, load balancing, performance, network, data consistency, etc., it is far from enough to rely solely on K8S's own components. It is necessary to plan, design, and select and add third-party components to form a complete and feasible solution. In this case, the IPV6 transformation should not only consider K8S's own components, but also focus on the transformation of the above-mentioned multiple third-party components, as well as the correlation and adaptation between the two.

[0005] In order to solve the above problems, people have been seeking an ideal technical solution. Summary of the invention

[0006] Based on this, it is necessary to provide a dual-stack K8S cluster implementation method based on IPV4 and IPV6 to address the above technical problems, which can solve the business needs of mixed deployment of IPV4 and IPV6.

[0007] In order to achieve the above object, the first aspect of the present invention provides a dual-stack K8S cluster implementation method based on IPV4 and IPV6, the method comprising: Build a K8S cluster, compile and install the load proxy component Nginx on the master node of the K8S cluster, and add the proxy information of N Master nodes to the configuration file of the load proxy component Nginx; wherein the K8S cluster includes N master nodes and M Node nodes; Compile and install the high-availability component keepalived on the master node of the K8S cluster, and modify the configuration file of the high-availability component keepalived to configure both the IPV6 virtual IP address and the IPV4 virtual IP address; Start the high-availability component keepalived to virtualize the IPV4 virtual IP address and IPV6 virtual IP address corresponding to the application microservice POD respectively; Deploy the network component Calico in the K8S cluster, and enable the network component Calico to support the IPV4 / IPV6 dual stack protocol; An application microservice POD is deployed on the Node node of the K8S cluster; wherein the application microservice POD is used to communicate and interconnect with external devices based on the virtualized IPV4 virtual IP address and IPV6 virtual IP address to realize corresponding business functions.

[0008] In order to achieve the above-mentioned object, the second aspect of the present invention provides a dual-stack K8S cluster based on IPV4 and IPV6, which includes N master nodes and M Node nodes, and the load proxy component Nginx is compiled and installed on the master node; wherein the configuration file of the load proxy component Nginx includes the proxy information of the N Master nodes; Compile and install the high-availability component keepalived on the master node of the K8S cluster, and modify the configuration file of the high-availability component keepalived to configure both the IPV6 virtual IP address and the IPV4 virtual IP address; Start the high-availability component keepalived to virtualize the IPV4 virtual IP address and IPV6 virtual IP address corresponding to the application microservice POD respectively; Deploy the network component Calico in the K8S cluster, and enable the network component Calico to support the IPV4 / IPV6 dual stack protocol; An application microservice POD is deployed on the Node node of the K8S cluster; wherein the application microservice POD is used to communicate and interconnect with external devices based on the virtualized IPV4 virtual IP address and IPV6 virtual IP address to realize corresponding business functions.

[0009] In order to achieve the above-mentioned objectives, the third aspect of the present invention provides an integrated video surveillance business system based on a dual-stack K8S cluster, which includes several levels of integrated video surveillance business terminals, and all levels of integrated video surveillance business terminals adopt the above-mentioned dual-stack K8S cluster; several application microservice PODs are deployed on the dual-stack K8S cluster, and different application microservice PODs communicate and interconnect with business terminals at other levels based on different IPV4 virtual IP addresses and / or IPV6 virtual IP addresses.

[0010] In order to achieve the above-mentioned objectives, the fourth aspect of the present invention provides an integrated video surveillance business system based on a dual-stack K8S cluster, including several levels of integrated video surveillance business terminals, wherein several levels of integrated video surveillance business terminals adopt the above-mentioned dual-stack K8S cluster; several application microservice PODs are deployed on the dual-stack K8S cluster, and different application microservice PODs communicate and interconnect with business terminals at other levels based on different IPV4 virtual IP addresses and / or IPV6 virtual IP addresses.

[0011] The beneficial effects of the present invention are: The present invention proposes a dual-stack K8S cluster implementation method based on IPV4 and IPV6. The method uses Calico, an open source network component that supports the IPV4 / IPV6 dual-stack protocol, to perform dual-stack improvement on the high-availability component Keepalived, so that the high-availability component keepalived is configured with both an IPV4 virtual IP address and an IPV6 virtual IP address, so that the application microservice POD deployed on the Node node can communicate and interconnect with external devices based on the virtualized IPV4 virtual IP address and the IPV6 virtual IP address, thereby meeting the business needs of IPV4 / IPV6 hybrid deployment. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 It is a structural diagram of the dual-stack K8S cluster based on IPV4 and IPV6 of the present invention; Figure 2 It is a comprehensive video surveillance business system based on a dual-stack K8S cluster of the present invention; Figure 3 This is the second comprehensive video surveillance business system based on a dual-stack K8S cluster of the present invention. DETAILED DESCRIPTION

[0013] The technical solution of the present invention is further described in detail below through specific implementation methods.

[0014] For ease of understanding, the interactive parties and / or terms and / or custom words involved in the present invention are first described in conjunction with the technical solution of the present invention: K8S cluster: refers to the K8S high-availability container cluster, including Master nodes, Node nodes, etc. The Master node refers to the cluster control node in Kubernetes, which is responsible for the management and control of the entire cluster. The Node node is responsible for executing the actual workload and providing the container running environment; For example, in a production environment, four servers are used to build a cluster consisting of two Master nodes and four Node nodes. The four Node nodes use Containerd as the container runtime, and three nodes in the cluster are reused to build an Etcd cluster, as shown in the attached figure. Figure 1 As shown; Containerd is an industrial-grade standard container runtime that emphasizes simplicity, robustness, and portability. Containerd is mainly used to manage the life cycle of containers (from creating containers to destroying containers), pull / push container images, storage management (manage the storage of images and container data, call runc to run containers (interact with runc and other container runtimes), and manage container network interfaces and networks. The present invention uses Containerd, which can better support dual stacks, as the container runtime. For IPV4 / IPV6 dual stacks, Containerd has good support and does not require configuration.

[0015] High-availability component keepalived: refers to a service software based on the VRRP protocol to ensure high availability of the cluster. Its main function is to implement failover of physical machines and switching between load balancers to prevent single point failures. It can virtualize VIP addresses and directly drift between redundant nodes when a node fails.

[0016] High-availability component keepalived: used to call custom scripts to detect whether the load proxy Nginx is running normally. The load proxy component Nginx is used to proxy the API Server of the Master node in the K8S cluster. When the API Server of one node fails, the other node can still provide normal access to the Node node, thereby improving the high availability of the cluster.

[0017] IPV4 and IPV6: Both are Internet Protocols, used for user identification and communication between different devices on the Internet. IPV4 is the abbreviation of Internet Protocol version 4, and IPv6 is the abbreviation of Internet Protocol Version 6.

[0018] Etcd cluster: refers to a distributed key-value database cluster that uses a multi-copy mechanism. For example, in a production environment, a three-node cluster is used, and only one of the nodes is allowed to fail. Figure 1 As shown in the figure, in the K8S cluster, the API Server interacts with the Etcd cluster and accesses the Etcd node through the IPV6 address; It should be noted that when creating a new application microservice POD, you need to specify basic information such as the number of replicas / CPU / memory / etc. This information needs to be stored in the Etcd cluster through the API Server. When the K8S cluster needs to be restarted, the application microservice POD needs to be recreated based on this information; It should also be noted that Etcd and API Server interact using the Https protocol, and need to use a custom CA-issued Etcd certificate. The certificate IP address should be filled in with the IPV4 / IPV6 dual addresses of all cluster nodes, and then use the open source tool cfssl to configure and generate the certificate. Replace the corresponding IP address in the Etcd configuration file with the IPv6 address, start each node, and verify the cluster status.

[0019] Open source network component Calico: used to assign IP addresses to application microservice PODs and solve cross-node communication between application microservice PODs. The default deployment yaml file of Calico does not have the relevant configuration to enable IPv6. Therefore, the present invention edits the yaml file of Calico to add the following parameters: assign_ipv6 / CALICO_IPV6POOL_CIDR / FELIX_IPV6SUPPORT. After adding, redeploy the Calico component. After deploying the application microservice POD, the IPV6 / IPV4 address assigned to the POD can be viewed through the corresponding command.

[0020] Application microservice POD: POD is the smallest deployment unit in Kubernetes. Different application microservice PODs implement different business functions. For example, in the comprehensive video surveillance business system, the application microservice POD is used to implement the video surveillance business.

[0021] Example 1 This embodiment provides a specific implementation method of a dual-stack K8S cluster implementation method based on IPV4 and IPV6; the method includes: Build a K8S cluster, compile and install the load proxy component Nginx on the master node of the K8S cluster, and add the proxy information of N Master nodes to the configuration file of the load proxy component Nginx; wherein the K8S cluster includes N master nodes and M Node nodes; Compile and install the high-availability component keepalived on the master node of the K8S cluster, and modify the configuration file of the high-availability component keepalived to configure both the IPV6 virtual IP address and the IPV4 virtual IP address; Start the high-availability component keepalived to virtualize the IPV4 virtual IP address and IPV6 virtual IP address corresponding to the application microservice POD respectively; Deploy the network component Calico in the K8S cluster, and enable the network component Calico to support the IPV4 / IPV6 dual stack protocol; An application microservice POD is deployed on the Node node of the K8S cluster; wherein the application microservice POD is used to communicate and interconnect with external devices based on the virtualized IPV4 virtual IP address and IPV6 virtual IP address to realize corresponding business functions.

[0022] It should be noted that this embodiment installs high-availability components keepalived and network components Calico on the K8S cluster, and performs dual-stack transformation on the high-availability components keepalived and network components Calico. The cluster nodes are configured with dual sets of IPV4 / IPV6 addresses at the same time, so that the K8S cluster can support the hybrid deployment of IPV4 and IPV6 services at the same time, effectively expanding the application scope of the K8S cluster.

[0023] It should also be noted that the load proxy component Nginx supports IPV4 by default. When compiling and installing the load proxy component Nginx, you need to add the --with-ipv6 parameter to enable Nginx to support IPV6. Performing dual-stack protocol transformation on the load proxy component Nginx can help solve the problem that traditional K8S solutions cannot support IPV6 well.

[0024] In some embodiments, when modifying the configuration file of the high-availability component keepalived to configure both the IPV6 virtual IP address and the IPV4 virtual IP address, execute: Add IPV6 virtual IP parameters and IPV4 virtual IP parameters to the configuration file of the high-availability component keepalived; wherein the IPV6 virtual IP parameter (virtual_ipaddress_excluded parameter) is used to configure the IPV6 virtual IP address corresponding to the application microservice POD, and the IPV4 virtual IP parameter (virtual_ipaddress parameter) is used to configure the IPV4 virtual IP address corresponding to the application microservice POD.

[0025] It should be noted that the dual stack implementation idea of ​​Keepalived in the present invention is: in the Keepalived configuration file Keepalived.conf, add the virtual_ipaddress_excluded parameter and the virtual_ipaddress parameter, the IPV6 virtual IP address is configured in the virtual_Ipaddress_excluded parameter, and the IPV4 virtual IP address is configured in the virtual_ipaddress parameter; Therefore, this embodiment adds the virtual_ipaddress_excluded parameter and the virtual_ipaddress parameter to set the dual-stack protocol for the high-availability component Keepalived, so that the cluster nodes are configured with dual sets of IPV4 / IPV6 virtual IP addresses at the same time.

[0026] It should also be noted that after the current master node fails, the two sets of virtual IP addresses of IPV4 / IPV6 virtualized by the high-availability component Keepalived will drift together. Therefore, this embodiment can also perform fault migration, thereby enhancing the reliability of the cluster.

[0027] In some embodiments, the dual-stack K8S cluster implementation method based on IPV4 and IPV6 also includes: configuring IPV4 / IPV6 dual protocol support corresponding to the application microservice POD.

[0028] In some embodiments, when configuring the IPV4 / IPV6 dual protocol support corresponding to the application microservice POD, execute: The configuration file yaml of the application microservice POD is modified, and an IP address family specifying parameter is added to the configuration file yaml; wherein the IP address family specifying parameter is used to specify the IP address family supported by the application microservice POD.

[0029] It should be noted that the K8S cluster IPV4 / IPV6 dual protocol stack provides the following functions: dual protocol stack POD network (each Pod is assigned an IPV4 and IPV6 address), enable IPv4 and IPv6 dual stack Service (Service is used to define the way to access the microservice POD in the cluster, enabled by the K8S component KUBE-PROXY), and enable IPV4 and IPV6 routing for the export of the POD cluster.

[0030] It should also be noted that the spec.ipFamilies parameter is used to specify which IP address families a node or API Server should support; therefore, the present invention can define the priority of the dual stack by setting the optional field spec.ipFamilies parameter on the Service.

[0031] In some embodiments, the dual-stack K8S cluster implementation method based on IPV4 and IPV6 also includes: Check whether the high-availability component keepalived virtualizes a dual-stack address to detect whether there is an abnormality in starting the virtual IP of the high-availability component keepalived; wherein the dual-stack address includes an IPV4 virtual IP address and an IPV6 virtual IP address.

[0032] It should be noted that, when the high-availability component keepalived is not started or the high-availability component keepalived does not virtualize a dual-stack address, it indicates that the high-availability component keepalived virtual IP startup is abnormal. After the abnormality, the staff needs to check the error information to locate the cause.

[0033] In a specific implementation, the dual-stack K8S cluster implementation method based on IPV4 and IPV6 includes: Step 1: Configure IPV4 / IPV6 dual-stack IP addresses on the four servers, turn off the server firewall and SELINUX, turn off the SWAP space, and change the node host name; Step 2: Change the server resource limit file limits.conf to prevent the IPVS component from overusing system resources. Set the boot-up to load IPVS related modules to support the stable operation of IPVS and ensure that kube-proxy uses IPVS for network communication; IPVS related modules include ip_vs, ip_vs_rr, ip_vs_wrr, ip_vs_sh, nf_conntrack, ip_tables, ip_set, xt_set, ipt_set, ipt_rpfilter, ipt_REJECT and Ipip, etc.; Step 3: Configure the modules required for Containerd to run Create the / etc / modules-load.d / containerd.conf configuration file to list the overlay / br_netfilter module that Containerd depends on to ensure that the required kernel modules are automatically loaded when the system starts. Overlay refers to the file system, and netfilter is the main framework in the Linux kernel for implementing functions such as packet filtering, connection tracking, and network address translation (NAT). The details are as follows: cat< <eof> / etc / modules-load.d / containerd.conf overlay br_netfilter EOF Run the modprobe overlay / modprobe br_netfilter commands to make them effective; Step 4: Install the ipvsadm installation package. The ipvsadm installation package refers to the IPVS installation package, and the installation package name is customized as ipvsadm.tar.gz. Step 5: Create the corresponding Containerd installation directory: / opt / containerd for installing Containerd; Edit the Containerd startup Service file (to enable the service), and unzip the Containerd installation package to the corresponding installation directory; Step 6: Set up Containerd to start at boot; Use crictl version to check the version information to confirm the installed Containerd version and ensure compatibility; Step 7. Compile and install the high-availability component keepalived and the load proxy component Nginx on the two master nodes (nodes 1 and 3 in this example), edit the configuration file keepalived.conf, configure the IPV6 virtual IP address in virtual_ipaddress_excluded, and the IPV4 virtual IP address in virtual_ipaddress. The relevant configuration parameters for IPV4 / IPV6 in Keepalived.conf are as follows: virtual_ipaddress { XXXX / X } virtual_ipaddress_excluded { X:X:X:X:X:X:X:X:X / X } Create a script directory scripts for Keepalived, and put the Nginx detection script in the scripts directory. Edit and modify the local IP address information in the custom script according to the actual environment. Step 8, edit the configuration file nginx.conf of the load proxy component Nginx, and add the proxy information of the two Master nodes as follows: upstream k8s-apiserver { server [X:X:X:X:X:X:X:X]:6443; server [X:X:X:X:X:X:X:X]:6443; } server { listen [X:X:X:X:X:X:X:X]:16443; proxy_pass k8s-apiserver; } For example, in the production environment, use port 16443 instead of the default port; Step 9: Start the high-availability component Keepalived and the load proxy component Nginx, virtualize the IPv4 and IPv6 addresses respectively, and use system commands to view the related processes of Nginx and Keepalived and the virtualized dual-stack addresses; Step 10: Generate a custom CA root certificate based on a predefined configuration file using the open source tool cfssl. The certificate is valid for 10 years. This CA certificate is used to issue Etcd certificates and K8S component certificates. Step 11. Include the IPV4 / IPV6 address when issuing the Etcd certificate. Use the open source tool cfssl for configuration. Fill in all the IPV4 and IPV6 addresses of the three etcd nodes with the parameter -hostname=, such as: -hostname=127.0.0.1,XXXX,XXXX,XXXX,X:X:X:X:X:X:X:X,X:X:X:X:X:X:X:X,X:X:X:X:X:X:X:X:X,X:X:X:X:X:X:X:X:X. After generating the certificate, copy the corresponding files (Etcd configuration file and certificate) to other Etcd nodes. Use system commands to link Etcd's Service to the startup directory, thereby configuring the Etcd startup Service file; Manually edit the node configuration file of Etcd and set the following parameters in the configuration file to define the IP address of Etcd: ETCD_INITIAL_CLUSTER=etcd-1=https: / / [X:X:X:X:X:X:X:X]:2380, etcd-2=https: / / [X:X:X:X:X:X:X:X]:2380,etcd-3=https: / / [X:X:X:X:X:X:X:X]:2380, ETCD_LISTEN_PEER_URLS=https: / / [X:X:X:X:X:X:X:X]:2380、 ETCD_INITIAL_ADVERTISE_PEER_URLS=https: / / [X:X:X:X:X:X:X:X]:2380、 ETCD_ADVERTISE_CLIENT_URLS=https: / / [X:X:X:X:X:X:X:X]:2379、ETCD_LISTEN_CLIENT_URLS=https: / / [X:X:X:X:X:X:X:X]:2379,https: / / [::1]:2379. Configure the IPv6 address in the IP address information in the above parameters, and the API Server application can access Etcd through the IPv6 address. The etcd deployment mode is a 3-node cluster. This deployment mode only allows one etcd node to go down. If more than one etcd node goes down, the entire cluster will become unusable. Step 12: After completing the deployment of the Etcd cluster, deploy K8S; The communication between K8S components uses the HTTPS protocol, which requires a certificate. In order to ensure the security of cluster communication, the CA certificate generated previously is used to issue certificates for other components (K8S components kube-apiserver, kube-proxy kubelet, kube-scheduler, kube-controller-manager). The issued certificate is valid for 10 years. In the configuration file for generating the certificate, fill in the IP address information as IPV4 and IPV6. Change the corresponding configuration files of the components to enable IPv6 to ensure that the configuration of IPv6 is enabled in each component; Edit and start the startup files kube-apiserver.service, kube-controller-manager.service, kubelet.service, and kube-proxy.service. For example, the content of kube-apiserver.service is as follows: [Unit] Description=Kubernetes API Server Documentation=https: / / github.com / kubernetes / kubernetes [Service] ExecStartPre= / bin / sleep 5 EnvironmentFile= / opt / kubernetes / cfg / kube-apiserver.conf ExecStart= / opt / kubernetes / bin / kube-apiserver $KUBE_APISERVER_OPTS Restart=on-failure [Install] WantedBy=multi-user.target Define the startup file of the K8S component api server based on the above code; The variable configuration file KUBE_APISERVER_OPTS is referenced in the system startup file to define the startup parameters of the K8S component api server; the specific content of the configuration file KUBE_APISERVER_OPTS is as follows: KUBE_APISERVER_OPTS="--v=2 \ --audit-log-maxage=30 \ --audit-log-maxbackup=3 \ --audit-log-maxsize=100 \ --audit-log-path={{ k8s_work_dir}} / logs / k8s-audit.log \ --feature-gates=InPlacePodVerticalScaling=true \ --default-not-ready-toleration-seconds=5 \ --default-unreachable-toleration-seconds=5" Other startup files are similar to the configuration files, but the referenced executable files are different and need to be changed during the specific configuration. Start each service process and check the cluster status. For example, in the actual configuration, nodes 1 and 3 are Master nodes, and nodes 2 and 4 are Node nodes. The Node nodes communicate with the API Server of the Master node through the virtual IP address, and the API Server interacts with Etcd. Step 13. After the K8S cluster is deployed, you need to deploy the network component Calico in the cluster. This component does not have the relevant configuration of enabling IPv6 by default. The specific configuration parameters of Calico enabling IPv6 are as follows: "assign_ipv6": "true", - name: CALICO_IPV6POOL_CIDR value: "fc00:: / 48" - name: FELIX_IPV6SUPPORT value: "true" Use CALICO_IPV6POOL_CIDR to define the IPV6 address segment and enable IPV6 support in K8S through FELIX_IPV6SUPPORT; Step 14: After all cluster components are deployed, deploy the application microservice POD; The K8S cluster IPV4 / IPV6 dual protocol stack provides the following functions: dual protocol stack POD network (each POD is assigned an IPV4 and IPV6 address), enabling IPV4 and IPV6 dual stack services, and enabling IPV4 and IPV6 routing for the POD cluster’s external egress; If you want to set which protocol stacks to use or define the priority of the dual stack, you need to set the optional field spec.ipFamilies parameter on the Service. The specific method is: Add the following to the yaml file of the application pod: spec: ipFamilyPolicy: PreferDualStack ipFamilies: - IPv6 - IPv4 The priority of the dual stack is determined by the order of configuration. IPV4 is configured first, which means IPV4 is preferred. IPV6 is configured first, which means IPV6 is preferred. The above code defines IPV6 priority. It should be noted that this priority is used to determine which protocol stack IP is displayed first when querying Service information, and will not affect the protocol stack binding order of the application microservice POD. After the Service defines ipFamilyPolicy, the IPV4 / IPV6 dual-stack network can assign both IPV4 and IPV6 addresses to the Service of the application microservice POD. The application microservice POD will establish a communication session connection based on the protocol family specified by the upper and lower business ends and bind the corresponding protocol stack address.

[0034] Example 2 Based on the same inventive concept, on the basis of the above embodiment, this embodiment provides a specific implementation of a dual-stack K8S cluster, wherein the dual-stack K8S cluster includes N master nodes and M Node nodes, and a load proxy component Nginx is compiled and installed on the master node; wherein the configuration file of the load proxy component Nginx includes proxy information of N Master nodes; Compile and install the high-availability component keepalived on the master node of the K8S cluster, and modify the configuration file of the high-availability component keepalived to configure both the IPV6 virtual IP address and the IPV4 virtual IP address; Start the high-availability component keepalived to virtualize the IPV4 virtual IP address and IPV6 virtual IP address corresponding to the application microservice POD respectively; Deploy the network component Calico in the K8S cluster, and enable the network component Calico to support the IPV4 / IPV6 dual stack protocol; An application microservice POD is deployed on the Node node of the K8S cluster; wherein the application microservice POD is used to communicate and interconnect with external devices based on the virtualized IPV4 virtual IP address and IPV6 virtual IP address to realize corresponding business functions.

[0035] It should be noted that some businesses use IPV4 communication, and some businesses use IPV6 communication. Therefore, the IPV4 virtual IP address and IPV6 virtual IP address virtualized by the dual-stack K8S cluster can enable the application microservice POD deployed on the K8S cluster to choose either the IPV4 virtual IP address to communicate and interconnect with external devices, or the IPV6 virtual IP address to communicate and interconnect with external devices, which is more flexible.

[0036] In some embodiments, the dual-stack K8S cluster based on IPV4 and IPV6 also includes an Etcd cluster. Issue the Etcd certificate of the Etcd cluster based on the pre-obtained custom CA certificate. When issuing the Etcd certificate, configure the host name parameter of the Etcd certificate to all IPV4 and IPV6 addresses corresponding to the K Etcd nodes; Set the IP address information of the corresponding parameters in the node configuration file of the Etcd cluster to the IPV6 address so that the API Server can access the Etcd node through the IPv6 address; Among them, the corresponding parameters in the node configuration file include Etcd initial cluster parameters (ETCD_INITIAL_CLUSTER), URL parameters for Etcd node-to-node listening (ETCD_LISTEN_PEER_URLS), initial peer announcement address parameters (ETCD_INITIAL_ADVERTISE_PEER_URLS), client advertisement address parameters (ETCD_ADVERTISE_CLIENT_URLS) and URL parameters for Etcd client listening (ETCD_LISTEN_CLIENT_URLS).

[0037] It should be noted that the corresponding parameters in the node configuration file need to be configured with specific IP and port. If IPV6 communication is used, it needs to be configured as an IPV6 address. After configuring the corresponding IP address of the Etcd configuration file as an IPV6 address, it can help solve the problem that the traditional K8S solution cannot support IPV6 well.

[0038] It should also be noted that this embodiment also issues component certificates of the K8S cluster based on the pre-configured custom CA certificate, and changes the configuration files of the corresponding components of the K8S cluster to enable IPV6, which can help solve the problem that the traditional K8S+Docker solution cannot support IPV6 well; wherein, the component certificates include API Server certificate, kubelet certificate, and kube-proxy certificate.

[0039] The full name of the above CA certificate is Certificate Authority. The main functions of the CA certificate include generating key pairs, generating digital certificates, distributing keys, and key management.

[0040] It should be noted that this embodiment ensures the association and adaptation between the two by modifying third-party components such as network component Calico, high-availability component Keepalived, load proxy component nginx, Etcd, and pre-configuring communication parameters (such as address, port, etc.) between k8s' own components and third-party components.

[0041] Example 3 Based on the above embodiment, this embodiment provides a specific implementation method of a comprehensive video surveillance service system based on a dual-stack K8S cluster; As attached Figure 2 As shown, the comprehensive video surveillance service system includes several levels of comprehensive video surveillance service terminals, and all levels of comprehensive video surveillance service terminals adopt the dual-stack K8S cluster based on IPV4 and IPV6 in Example 2; Several application microservice PODs are deployed on the dual-stack K8S cluster. Different application microservice PODs communicate and interconnect with business terminals at other levels based on different IPV4 virtual IP addresses and / or IPV6 virtual IP addresses.

[0042] It should be noted that for services with mixed deployment of IPV4 / IPV6, this embodiment adopts the dual-stack K8S cluster in Example 2. This method is suitable for application scenarios of building new business systems.

[0043] Example 4 Based on the above embodiment, this embodiment also provides another specific implementation method of a comprehensive video surveillance service system based on a dual-stack K8S cluster; As attached Figure 3 As shown, the comprehensive video surveillance service system includes several levels of comprehensive video surveillance service terminals, wherein the comprehensive video surveillance service terminals at several levels adopt the dual-stack K8S cluster based on IPV4 and IPV6 in Example 3; Several application microservice PODs are deployed on the dual-stack K8S cluster. Different application microservice PODs communicate and interconnect with business terminals at other levels based on different IPV4 virtual IP addresses or IPV6 virtual IP addresses.

[0044] It should be noted that this embodiment is suitable for partial upgrades and modifications of existing business systems. It is not necessary for the entire business system to adopt a dual-stack K8S cluster, but only a part of the business end adopts a dual-stack K8S cluster; the business end using the dual-stack K8S cluster binds the IP protocol family address corresponding to the corresponding application microservice POD according to the IP address family specified by the upper and lower business ends.

[0045] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0046] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, ordinary technicians in the field should understand that the specific implementation methods of the present invention can still be modified or some technical features can be replaced by equivalents without departing from the spirit of the technical solution of the present invention, which should be included in the scope of the technical solution for protection of the present invention.< / eof>

Claims

1. A dual-stack K8S cluster implementation method based on IPV4 and IPV6, characterized in that: include: Build a K8S cluster, compile and install the load proxy component Nginx on the master node of the K8S cluster, and add the proxy information of N Master nodes to the configuration file of the load proxy component Nginx; wherein the K8S cluster includes N master nodes and M Node nodes; Compile and install the high-availability component keepalived on the master node of the K8S cluster, and modify the configuration file of the high-availability component keepalived to configure both the IPV6 virtual IP address and the IPV4 virtual IP address; Start the high-availability component keepalived to virtualize the IPV4 virtual IP address and IPV6 virtual IP address corresponding to the application microservice POD respectively; Deploy the network component Calico in the K8S cluster, and enable the network component Calico to support the IPV4 / IPV6 dual stack protocol; An application microservice POD is deployed on the Node node of the K8S cluster; wherein the application microservice POD is used to communicate and interconnect with external devices based on the virtualized IPV4 virtual IP address and IPV6 virtual IP address to realize corresponding business functions.

2. According to the dual-stack K8S cluster implementation method based on IPV4 and IPV6 according to claim 1, it is characterized in that: To modify the configuration file of the high-availability component keepalived to configure both the IPV6 virtual IP address and the IPV4 virtual IP address, execute: Add IPV6 virtual IP parameters and IPV4 virtual IP parameters in the configuration file of the high-availability component keepalived; Among them, the IPV6 virtual IP parameter is used to configure the IPV6 virtual IP address corresponding to the application microservice POD, and the IPV4 virtual IP parameter is used to configure the IPV4 virtual IP address corresponding to the application microservice POD.

3. The dual-stack K8S cluster implementation method based on IPV4 and IPV6 according to claim 1 or 2, characterized in that: Also includes: Configure the IPV4 / IPV6 dual protocol support corresponding to the application microservice POD.

4. The dual-stack K8S cluster implementation method based on IPV4 and IPV6 according to claim 3 is characterized in that: When configuring the IPV4 / IPV6 dual protocol support corresponding to the application microservice POD, execute: The configuration file yaml of the application microservice POD is modified, and an IP address family specifying parameter is added to the configuration file yaml; wherein the IP address family specifying parameter is used to specify the IP address family supported by the application microservice POD.

5. The dual-stack K8S cluster implementation method based on IPV4 and IPV6 according to claim 3 is characterized in that: Also includes: Check whether the high-availability component keepalived virtualizes a dual-stack address to detect whether there is an abnormality in starting the virtual IP of the high-availability component keepalived; wherein the dual-stack address includes an IPV4 virtual IP address and an IPV6 virtual IP address.

6. A dual-stack K8S cluster based on IPV4 and IPV6, characterized in that: It includes N master nodes and M Node nodes, and the load proxy component Nginx is compiled and installed on the master node; wherein the configuration file of the load proxy component Nginx includes the proxy information of the N Master nodes; Compile and install the high-availability component keepalived on the master node of the K8S cluster, and modify the configuration file of the high-availability component keepalived to configure both the IPV6 virtual IP address and the IPV4 virtual IP address; Start the high-availability component keepalived to virtualize the IPV4 virtual IP address and IPV6 virtual IP address corresponding to the application microservice POD respectively; Deploy the network component Calico in the K8S cluster, and enable the network component Calico to support the IPV4 / IPV6 dual stack protocol; An application microservice POD is deployed on the Node node of the K8S cluster; wherein the application microservice POD is used to communicate and interconnect with external devices based on the virtualized IPV4 virtual IP address and IPV6 virtual IP address to realize corresponding business functions.

7. The dual-stack K8S cluster based on IPV4 and IPV6 according to claim 6, characterized in that: Also includes Etcd cluster, Issue the Etcd certificate of the Etcd cluster based on the pre-obtained custom CA certificate. When issuing the Etcd certificate, configure the host name parameter of the Etcd certificate to all IPV4 and IPV6 addresses corresponding to the K Etcd nodes; Set the IP address information of the corresponding parameters in the node configuration file of the Etcd cluster to the IPV6 address so that the API Server can access the Etcd node through the IPv6 address; The corresponding parameters in the node configuration file include Etcd initial cluster parameters, URL parameters for Etcd node-to-node monitoring, initial peer announcement address parameters, client advertisement address parameters, and URL parameters for Etcd client monitoring.

8. A comprehensive video surveillance service system based on a dual-stack K8S cluster, characterized in that: It includes several levels of integrated video surveillance service terminals, and all levels of integrated video surveillance service terminals adopt the dual-stack K8S cluster based on IPV4 and IPV6 as described in claim 6 or 7; Several application microservice PODs are deployed on the dual-stack K8S cluster. Different application microservice PODs communicate and interconnect with business terminals at other levels based on different IPV4 virtual IP addresses and / or IPV6 virtual IP addresses.

9. A comprehensive video surveillance service system based on a dual-stack K8S cluster, characterized in that: It includes several levels of integrated video surveillance service terminals, wherein the several levels of integrated video surveillance service terminals adopt the dual-stack K8S cluster based on IPV4 and IPV6 as described in claim 6 or 7; Several application microservice PODs are deployed on the dual-stack K8S cluster. Different application microservice PODs communicate and interconnect with business terminals at other levels based on different IPV4 virtual IP addresses and / or IPV6 virtual IP addresses.

Citation Information

Cited By

  • Method and system for creating dual-stack container cluster, terminal and medium

    CN120186133A

  • Method and device for automatic box opening and instant use of intelligent calculation all-in-one machine

    CN121309304A

  • A method and device for automatic unpacking of a smart integrated machine

    CN121309304B