Installing and Configuring Kubernetes Nodes
Install and configure Kubernetes on the management and compute nodes in the cluster.
Changing the Host Name and Mapping
Perform the operations on all management and compute nodes.
- Set the host name of each node.
Management node:
hostnamectl set-hostname master
Compute node 1:
hostnamectl set-hostname compute01
Compute node 2:
hostnamectl set-hostname compute02
After the setting is complete, log in to the OS again for the change to take effect.
- Modify the hosts files on all nodes.
- Open the hosts file.
vi /etc/hosts
- Press i to enter the insert mode and add the IP addresses and host names of all nodes in the cluster to the configuration file.
192.168.1.11 master 192.168.1.12 compute01 192.168.1.13 compute02
See the result:

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the hosts file.
Installing the Base Components
- Disable the firewall.
systemctl stop firewalld && systemctl disable firewalld
- Install Docker.
yum install -y docker cat <<EOF > /etc/docker/daemon.json { "exec-opts": ["native.cgroupdriver=systemd"] } EOF systemctl daemon-reload systemctl restart docker - Enable the NET.BRIDGE.BRIDGE-NF-CALL-IPTABLES kernel option.
sysctl -w net.bridge.bridge-nf-call-iptables=1
- Disable the swap partition.
- Disable the swap partition.
swapoff -a
- Open the /etc/fstab file.
vi /etc/fstab
- Press i to enter the insert mode and comment out the swap partition information.
# /dev/mapper/openeuler-swap none swap defaults 0 0
- Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
- Disable the swap partition.
- Install Kubernetes.
yum install -y kubelet kubeadm kubectl kubernetes-cni
If the above command fails to be executed, run the following command:
yum install -y kubelet kubeadm kubectl kubernetes-cni --nobest
- Check the Kubernetes installation status.
rpm -qa | grep kubelet rpm -qa | grep kubeadm rpm -qa | grep kubectl rpm -qa | grep kubernetes-cni
- Configure iptables.
echo "net.bridge.bridge-nf-call-iptables=1" > /etc/sysctl.d/k8s.conf
- Enable the kubelet service.
systemctl enable kubelet
Configuring NTP
Configure NTP to synchronize the time between nodes in the cluster.
- Install chrony and set the time zone on all nodes. In this document, an Asian time zone is used as an example.
yum install -y chrony timedatectl set-timezone Asia/Shanghai
- Set the management node as the NTP server node.
- Open the /etc/chrony.conf file.
vi /etc/chrony.conf
- Press i to enter the insert mode and add the following content:
allow 192.168.1.0/24 local stratum 10
Replace the example network segment 192.168.1.0/24 with the actual one.
- Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
- Open the /etc/chrony.conf file.
- Configure compute nodes as NTP clients.
- Open the /etc/chrony.conf file.
vi /etc/chrony.conf
- Press i to enter the insert mode and comment out the following line:
pool pool.ntp.org iburst
The following figure shows the modification result:

Add the following content:
server master iburst
- Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
- Open the /etc/chrony.conf file.
- Start the NTP service.
- Start the NTP service on all nodes and check the service status.
systemctl enable chronyd.service systemctl start chronyd.service systemctl status chronyd.service
- Start NTP synchronization on all nodes.
timedatectl set-ntp no timedatectl set-ntp yes
- Start the NTP service on all nodes and check the service status.
- Verify time synchronization.
chronyc sources
The clock source on the compute node is master:

Run the date command on each node to check whether the time is the same.
date
Downloading Other Components Using Docker
Perform the following steps on all nodes in the cluster.
- View the image list and determine the Docker image version to be downloaded.
kubeadm config images list
- Different versions of Kubernetes may require different versions of Docker images. Therefore, you need to view the image list and select the right Docker image version. The Docker image version used in 2 is for reference only.
- Ensure that the downloaded Docker image supports the Arm architecture.
- Download the image from Docker Hub.
- If openEuler 22.03 is used, you are advised to install Kubernetes 1.23.1.
docker pull k8s.gcr.io/kube-apiserver:v1.23.1 docker pull k8s.gcr.io/kube-controller-manager:v1.23.1 docker pull k8s.gcr.io/kube-scheduler:v1.23.1 docker pull k8s.gcr.io/kube-proxy:v1.23.1 docker pull k8s.gcr.io/pause:3.6 docker pull k8s.gcr.io/etcd:3.5.1-0 docker pull k8s.gcr.io/coredns/coredns:v1.8.6
- If openEuler 20.03 or CentOS is used, you are advised to install Kubernetes 1.18.20.
1 2 3 4 5 6 7
docker pull k8smx/kube-apiserver:v1.18.20 docker pull k8smx/kube-controller-manager:v1.18.20 docker pull k8smx/kube-scheduler:v1.18.20 docker pull k8smx/kube-proxy:v1.18.20 docker pull k8smx/pause:3.2 docker pull k8smx/coredns:1.6.7 docker pull k8smx/etcd:3.4.3-0
If you cannot pull images from dockerhub.io, you are advised to configure the Docker image accelerator in advance and use other image sources to download the required Docker images. For details about how to change the image source, see Changing the Image Source.
- If openEuler 22.03 is used, you are advised to install Kubernetes 1.23.1.
- Query the Docker image components of Kubernetes.
docker images | grep k8s