0
Follow
0
View

Encountered a problem initializing the k8s cluster using kubeadm

aa285312415 注册会员
2023-02-26 17:22

the reference answer GPT ᴼ ᴾ ᴱ ᴺ ᴬ ᴵ < br / > when initialize clustering problems may have a lot of kinds, can according to the specific error message. Here are some possible problems and solutions:

  1. kubeadm init prompts "error execution phase preflight: [preflight] Some fatal errors occurred:" and lists some error messages.
    This may be because Kubernetes requires the system to meet some prerequisites, such as turning off swap, setting the correct iptables rules, and so on. You can resolve these issues one by one based on the error message.

  2. "error execution phase kubelet-start: [kubelet-start] Init failed" is displayed during kubeadm init, and some error messages are listed.
    This may be because kubelet failed to start. Check the kubelet log to find out the cause and try to resolve it. For example, it may be that kubelet starts without certain dependencies, which can be manually installed.

  3. error execution phase certs/apiserver: couldn't initialize a Kubernetes API client: Error execution phase certs/apiserver: Couldn't initialize a Kubernetes API client: get https://localhost:6443/api/v1/namespaces/kube-public : dial tcp [::1]:6443: connect: The connection refused".
    This may be because kube-apiserver fails to start. You can view the kube-apiserver log to find the cause and try to rectify it. For example, there may be some error when kube-apiserver is started. You can check the log file to find out the specific error information.

  4. error execution phase kubelet-finalize: [kubelet-finalize] Update NodeStatuses failed:

  5. Error execution phase kubelet-finalize: [kubelet-finalize] update nodeStatuses failed: the server has asked for the client to provide credentials".
    This may be because kubectl is incorrectly configured with the authentication information. You can run the "kubectl config use-context "command to switch to the correct context or re-generate the authentication information.

  6. "error execution phase upload-config: error execution phase upload-config: [upload-config] storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace failed". [upload-config] Storing the configuration used in configmap "kubeadm-config" in the "kube-system" namespace failed".
    This may be because kubelet is not starting correctly. Check the kubelet log to find out the specific cause and try to resolve it. For example, it may be that kubelet starts without certain dependencies, which can be manually installed.

The preceding lists only some possible problems and their solutions. Troubleshoot specific problems based on error information. If the problem persists, it is recommended to consult the Kubernetes official documentation or ask the community for help.

cuiruxiang 注册会员
2023-02-26 17:22

Part of the answer refers to GPT, GPT_Pro better solve the problem
A: When using kubeadm to initialize the K8s cluster, if we encounter the error shown in the above figure, it may be because the driver of docker and kubelet has a problem, so we need to check whether docker and kubelet services are normal.

Check docker service:
We can use the following command to check docker service is normal:

systemctl status docker

If the service status is active(running), it indicates that docker service is running normally; If the service state is inactive(dead), the docker service is abnormal and needs to be restarted.

Restart docker service:

systemctl restart docker

Check kubelet service:
We can use the following command to check that kubelet service is normal:

systemctl status kubelet

If the service status is active(running), it indicates that the kubelet service is running normally; If the service status is inactive(dead), the kubelet service is abnormal and you need to restart the kubelet service.

Restart kubelet service:

systemctl restart kubelet

After rechecking the docker and kubelet services, if both are working properly, you can try reinitializing the K8s cluster to see if the problem is resolved.
If the answer is helpful, please accept it.

demonwolf 注册会员
2023-02-26 17:22

The following answers are quoted from GPT-3 model, please use them wisely:


Error messages may be caused by compatibility problems between kubelet and Docker, so kubelet or Docker may need to be upgraded. If the error occurs during cluster initialization, you can try to fix it with the following command:

sudo systemctl restart docker
sudo systemctl restart kubelet # Restart kubelet

If the error still occurs, you can try to upgrade Docker or Kubelet as follows:

Upgrade Docker

wget https://download.docker.com/linux/ubuntu/dists/[ubuntu%E7%89%88%E6%9C%AC]/pool/stable/amd64/ # Download Docker-ce
sudo apt purge Docker-ce # Clear docker
sudo dpkg -i # Install Docker-ce
sudo systemctl start docker # Restart docker

Upgrade kubelet

curl -sSL < span > https://packages.cloud.google.com/apt/doc/apt-key.gpg < / span > < / a > | sudo apt - add GPG key add - # Key
echo "deb
http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
sudo apt update #