Skip to content

Network Configuration ​

Kubernetes cluster network configuration. Single-node Converged Architecture can skip this step. This configuration only applies to multi-node Converged Architecture and Professional Architecture cluster installations. All cluster machines must have consistent network settings.

Purpose and Requirements ​

Network Interface Name Consistency Requirement ​

In a Kubernetes cluster, to ensure proper operation of inter-node communication, Pod network communication (CNI), and core components like kubelet, all nodes must use the same network interface name (NIC name) for internal cluster communication.

  • Issue Source: Different servers or virtualization environments may generate different default NIC names (e.g., eth0, ens160, eno1, etc.).
  • Requirement: To avoid communication anomalies, all node communication NIC names must be unified, recommended to be eth0.

Check Current NIC Names ​

On each node server, run the following command to confirm the NIC name used for cluster communication:

bash
ip addr show

Or use a more concise command to get the name list:

bash
ip -o link show | awk -F': ' '{print $2}'

Identify the actual name of the NIC you plan to use for cluster communication.

Modify NIC Names ​

If communication NIC names are inconsistent across nodes, you can use netplan's set-name feature to rename and unify them to the target name (e.g., eth0).

Identify Current NIC Information ​

Run the command to view detailed information and record the current NIC name and MAC address:

bash
ip link show

Example output and information recording:

bash
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 3c:ec:ef:a1:93:0f brd ff:ff:ff:ff:ff:ff

Current Information Recorded: NIC name is eno1, MAC address is 3c:ec:ef:a1:93:0f.

Edit Netplan Configuration File ​

The configuration file is usually a .yaml file under /etc/netplan/ (e.g., 00-installer-config.yaml):

bash
vim /etc/netplan/00-installer-config.yaml

Add or modify configuration content, set IP, gateway, DNS, and use set-name and match.macaddress for renaming:

bash
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}

network:
  ethernets:
    eno1: # Replace with current NIC name
      addresses:
        - 192.168.100.148/24 # Replace with your IP address and subnet mask
      routes:
        - to: default
          via: 192.168.100.1
      nameservers:
        addresses:
          - 192.168.100.1 # Replace with your DNS server address
      # Target name: rename eno1 to eth0
      set-name: eth0
      match:
        # Exact match MAC address
        macaddress: 3c:ec:ef:a1:93:0f # Replace with your recorded MAC address
  version: 2

Apply Configuration and Activate ​

Run the netplan apply command to activate the new network configuration and NIC renaming:

bash
netplan apply

Important Note: If you are operating remotely via SSH, SSH connection may be temporarily interrupted after applying this configuration. Ensure you have serial console, IPMI, or other out-of-band management methods for backup access in case network renaming fails and connection is lost.

Open the configuration file 99-disable-network-config.cfg, this file comes from the comment section in the configuration above:

bash
vim /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg

Add the following content:

bash
network: {config: disabled}

Verify Renaming ​

Run the following command to verify the NIC has been successfully renamed to the target name eth0:

bash
ip addr show eth0

Ensure the NIC name has been successfully changed from the original name (e.g., eno1) to eth0, and the network connection is normal.