Installation method 1 (recommended):
Refer to the Kubernetes official website to install Kubernetes.
If you encounter any problem during cluster initialization, see "Reference" > "FAQs" > "Faults During Installation" > "Kubernetes Initialization Failed" in MindCluster Cluster Scheduling Installation Guide.
Installation method 2:
Install Kubernetes by referring to the Alibaba image source. The following operations are performed on the management node. It is recommended that the software with the Arm architecture be used.
If information such as "No match for argument: socat" or "nothing provides socat needed by xxx" is output, the socat library is missing in the environment. Rectify this fault as follows. (The same command output will be displayed if other libraries, such as iptables and conntrak, are missing.)
Run the following command to install the missing library:
# CentOS yum install -y socat # Ubuntu apt-get install -y socat
kubeadm config images list
docker pull k8s.gcr.io/kube-apiserver:v1.23.0
kubeadm init
Then, execute the content displayed in Figure 2, as shown in the following:
mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl get pods -A
Run the following command to reset Kubernetes configurations. If information similar to Figure 4 is displayed, the Kubernetes configurations are successfully reset.
kubeadm reset
After the reset is successful, you need to manually delete the {$HOME}/.kube/config file to ensure that all Kubernetes configurations are deleted.
If only one server is used in the cluster, you do not need to add compute nodes. In this case, skip the following steps.
The node to be added must meet the following requirements:
kubeadm and kubelet have been installed.
kubeadm token create
openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //'
set +o history
set -o history
kubeadm join ip:port --token {token} \
-discovery-token-ca-cert-hash sha256:{ca-cert code}
hostname
If the host name conflicts with the name of another node in the cluster, modify the /etc/hostname file to change the host name.
#kubectl label nodes {node_name} accelerator=huawei-Ascend910
kubectl label nodes localhost.localdomain accelerator=huawei-Ascend910
kubectl get nodes --show-labels