问题一:
kubeadm init --kubernetes-version=1.17.0
–apiserver-advertise-address=198.168.1.1
–image-repository registry.aliyuncs.com/google_containers
–service-cidr=10.1.0.0/16
–pod-network-cidr=10.244.0.0/16
初始化master节点失败,报错信息如下:
nfortunately, 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 way (required cgroups disabled)
If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
- 'systemctl status kubelet'
- 'journalctl -xeu kubelet'
Additionally, a control plane component may have crashed or exited when started by the container runtime.
To troubleshoot, list all containers using your preferred container runtimes CLI, e.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
To see the stack trace of this error execute with --v=5 or higher
/etc/sysconfig/modules/ipvs.modules && lsmod | grep -e ip_vs -enf_conntrack_ipv4
chmod 755 /etc/sysconfig/modules/ipvs.modules && bash
/etc/sysconfig/modules/ipvs.modules && lsmod | grep -e ip_vs -enf_conntrack_ipv4
网上有很多种失败的原因,我出现的原因是因为IP地址用的是公网IP,
为什么不能用勒?是因为–apiserver-advertise-address=这里的IP是需要填写服务器内网IP,而不是公网IP,如果是虚拟机的话好像是可以直接用虚拟机的IP地址的
因为在云上面,公网 IP 地址在广域网上,内网 IP 地址在 VPC 里面。K8S 只能基于 VPC 里面的地址段做 Overlay 网络。
公网 IP 地址实际上是在另外一个机器上,通过网关转发到你的服务器的,并不是说,这个 IP 地址真的在你的服务器上。
错误二:[WARNING IsDockerSystemdCheck]: detected “cgroupfs” as the Docker cgroup driver作为Docker cgroup驱动程序。,Kubernetes推荐的Docker驱动程序是“systemd”
解决方案:修改Docker的配置: vi /etc/docker/daemon.json,加入
{
“exec-opts”:[“native.cgroupdriver=systemd”]
}
然后重启 Docker
错误三:[ERROR NumCPU]: the number of available CPUs 1 is less than the required 2
解决方案:修改虚拟机的CPU的个数,至少为2个
错误四:官方文档安装版本看错,导致一直安装不上
错误卡了我3个多小时,并且我第一次我安装的时候好像也遇到过,但是没涨记性,导致第二次也浪费3个多小时!!!所以特此记录下!
网上还有很多种奇奇怪怪的错误,需要大家慢慢的解决
友情链接
k8s中文文档,非常全,里面还可以加群,问群里大佬!
重装k8s出现的错误
问题描述
因为做集群化,开始有一部操作是编写/etc/hosts文件,写三个服务器的IP,因之前写的是公网IP,我子节点一直不能成功,所以后面把hosts文件也改成了内网IP,还需要kubeadm init。然后就出现
Unable to connect to the server: x509: certificate signed by unknown authority (possibly because of “crypto/rsa: verification error” while trying to verify candidate authority certificate “kubernetes”)
这个是因为我们成功的时候根据提示执行了下面三个命令,虽然我们kubeadm reset了,但是没有删除.kube文件,所以找不到现在安装的这个集群
解决办法
再次成功后,先执行下面的命令,再去执行上图的三个命令就ok了!!!其实就是删除之前的一些遗留的东西把
rm -rf $HOME/.kube