kubernetes一些报错集合

kubeadm init 初始化出错

[wait-control-plane] Waiting for the kubelet to boot up the control plane as stati Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
[kubelet-check] Initial timeout of 40s passed.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' ailed with error: Get http://localhost:10248/healthz: dial tcp 127.0.0.1:10248: conect: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' ailed with error: Get http://localhost:10248/healthz: dial tcp 127.0.0.1:10248: conect: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' ailed with error: Get http://localhost:10248/healthz: dial tcp 127.0.0.1:10248: conect: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' ailed with error: Get http://localhost:10248/healthz: dial tcp 127.0.0.1:10248: conect: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' ailed with error: Get http://localhost:10248/healthz: dial tcp 127.0.0.1:10248: conect: connection refused.
Unfortunately, an error has occurred:
        timed out waiting for the condition
This error is likely caused by:
        - The kubelet is not running
        - The kubelet is unhealthy due to a misconfiguration of the node in some wy (required cgroups disabled)
If you are on a systemd-powered system, you can try to troubleshoot the error withthe following commands:
        - 'systemctl status kubelet'
        - 'journalctl -xeu kubelet'
Additionally, a control plane component may have crashed or exited when started bythe container runtime.
To troubleshoot, list all containers using your preferred container runtimes CLI, .g. docker.
Here is one example how you may list all Kubernetes containers running in docker:
        - 'docker ps -a | grep kube | grep -v pause'
        Once you have found the failing container, you can inspect its logs with:
        - 'docker logs CONTAINERID'
error execution phase wait-control-plane: couldn't initialize a Kubernetes cluster

==原因==

这是因为kubelet没启动

==解决==

systemctl restart kubelet

[preflight] Running pre-flight checks [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/ error execution phase preflight: [preflight] Some fatal errors occurred: [ERROR FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml]: /etc/kubernetes/manifests/kube-apiserver.yaml already exists [ERROR FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml]: /etc/kubernetes/manifests/kube-controller-manager.yaml already exists [ERROR FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml]: /etc/kubernetes/manifests/kube-scheduler.yaml already exists [ERROR FileAvailable--etc-kubernetes-manifests-etcd.yaml]: /etc/kubernetes/manifests/etcd.yaml already exists [ERROR DirAvailable--var-lib-etcd]: /var/lib/etcd is not empty [preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`

=解决:==

systemctl stop kubelet
rm -f /etc/kubernetes/manifests/*
rm -rf /var/lib/etcd/*

kubernates删除pod一直处于terminating状态

kubectl delete pods --grace-period=0 --force POD名

工作节点Node 在kubectl join加入后Master查看不到
节点kubectl join加入集群成功后,下面命令查看不到该Node。但是使用-o wide选项能看到

kubectl get nodes

检查下主机名,所有的主机名都不能冲突,Node重新安装k8s再加入

hostname

不同Pod之间无法相互Ping通
查看iptables的FORWARD链默认策略是否为ACCEPT

# iptables -vnL | grep "Chain FORWARD"
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)

如果不是,则修改:
vim /lib/systemd/system/docker.service
在ExecStart=后追加一行