Rate This Document
Findability
Accuracy
Completeness
Readability

Common Operations on All Nodes

  1. Change the host names to ensure that the host name of each server is unique.

    For example:

    • On the master node, change the host name to k8s-master.
      hostnamectl set-hostname k8s-master
      bash
    • On the worker node, change the host name to k8s-slave1.
      hostnamectl set-hostname k8s-slave1
      bash
  2. Change the passwords of all servers to the same.
  3. Disable the firewall.
    systemctl stop firewalld
    systemctl disable firewalld
  4. Disable SWAP partitions.
    • Run the following command. The setting becomes invalid after the server restarts.
      swapoff -a   
    • Comment out the code for automatic mounting of SWAP partitions in the fstab file. The setting is still valid after the server restarts.
      1. Open the fstab file.
        vi /etc/fstab
      2. Press i to enter the insert mode and comment out the line where /dev/mapper/openeuler-swap is located.
      3. Press Esc, type :wq, and press Enter to save the file and exit.
  5. Disable SELinux.
    1. Open the /etc/selinux/config file. If the file does not exist, create one and open it.

      vi /etc/selinux/config
    2. Press i to enter the insert mode and change the value of SELINUX to disabled.
      1
      SELINUX=disabled
      
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  6. Configure the source required for installing Kubernetes cluster software.
    1. Go to the /etc/yum.repos.d/ directory.
      cd /etc/yum.repos.d/
    2. Open the kubernetes.repo file.
      vi kubernetes.repo
    3. Press i to enter the insert mode and add the following content:
      [kubernetes]
      name=Kubernetes
      baseurl=https://pkgs.k8s.io/core:/stable:/v1.28/rpm/
      enabled=1
      gpgcheck=1
      gpgkey=https://pkgs.k8s.io/core:/stable:/v1.28/rpm/repodata/repomd.xml.key
      exclude=kubelet kubeadm kubectl cri-tools kubernetes-cni
    4. Press Esc, type :wq!, and press Enter to save the file and exit.
  7. Install Kubernetes cluster software.
    yum install -y kubelet kubeadm kubectl kubernetes-cni --disableexcludes=kubernetes
    systemctl enable --now kubelet
  8. Install containerd and runC based on 1 to 3 in (Optional) Deploying the Containerd Environment. After the installation is successful, restart the Docker service based on 6 on the worker node.
  9. Modify the containerd configuration file.
    mkdir -p /etc/containerd/
    cd /etc/containerd/
    containerd config default > /etc/containerd/config.toml
    1. Open the /etc/containerd/config.toml file.
      vi /etc/containerd/config.toml
    2. Press i to enter the insert mode and change the value of SystemdCgroup to true.
      SystemdCgroup = true
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  10. Configure crictl.
    1. Open the crictl.yaml file.
      vi /etc/crictl.yaml 
    2. Press i to enter the insert mode and add the following content:
      runtime-endpoint: unix:///run/containerd/containerd.sock
      image-endpoint: unix:///run/containerd/containerd.sock
      timeout: 10
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
    4. Restart containerd.
      systemctl daemon-reload
      systemctl restart containerd
  11. Configure network forwarding. Perform this step again after the server is restarted.
    modprobe overlay
    modprobe br_netfilter
    1. Open the k8s.conf file.
      vi /etc/sysctl.d/k8s.conf 
    2. Press i to enter the insert mode and add the following content:
      net.bridge.bridge-nf-call-ip6tables=1
      net.bridge.bridge-nf-call-iptables=1
      net.ipv4.ip_forward=1
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
    4. Make the configuration take effect.
      sysctl -p /etc/sysctl.d/k8s.conf