- hostname 和 DNS 的解析规则不匹配
nodeRegistration.name: Invalid value: "vm_0_2_centos": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
原因是 hostname 和 DNS 的解析规则不匹配, 不能有除 -和 . 之外的特殊字符存在。注意是主机名hostname
,不可有-
或者.
分析过程,查看当前主机的hostname
hostname
vm_0_2_centos
更改主机名,可以执行如下语句:
hostnamectl set-hostname k8s-master
ip_forward not set to 1
[ERROR FileContent--proc-sys-net-ipv4-ip_forward]: /proc/sys/net/ipv4/ip_forward contents are not set to 1`
设置为1即可
echo 1 > /proc/sys/net/ipv4/ip_forward
-
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
这是docker
服务没有起来systemctl daemon-reload
service docker restart
systemctl enable docker.service
service docker status
[root@master yum.repos.d]# docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.18.0
Error response from daemon: Get https://registry.cn-hangzhou.aliyuncs.com/v2/: proxyconnect tcp: dial tcp 172.96.236.117:10070: connect: connection refused
这里需要注册一个阿里云的用户,然后登录阿里云的Registry
参考链接 https://blog.csdn.net/u012720518/article/details/105352451
docker pull
加速方法
cat /etc/docker/daemon.json # 修改文件, 这一步骤查看自己的阿里云账户信息
{
"registry-mirrors": ["https://rppul91c.mirror.aliyuncs.com"]
}
# 重新启动docker
systemctl daemon-reload
systemctl restart docker.service
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"```
删除.kube/目录,rm -rf ./kube
参考链接 https://blog.csdn.net/woay2008/article/details/93250137
[root@master ~]# kubectl get nodes
error: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
缺少 .kube/config
文件
[root@master ~]# mkdir .kube
[root@master ~]# cp /etc/kubernetes/admin.conf .kube/config
8
ImagePullBackOff
利用阿里云下载相关镜像
9
No resources found in default namespace.
解决方法:
# kubectl get pods 需要指明命名空间
# kubectl get nodes 查看节点
10
coredns-66bff467f8-6bwmz 0/1 ContainerCreating 0 8m45s
查了好多,没啥好办法。kubeadm reset重置后,删除.kube目录,kube-flannel.yaml文件。在重新部署就好了。。好了。。
在添加节点执行报错时(文件已存在或者端口被占用), 可以执行kubeadm reset
即可。
kubeadm join
12
error: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
将当前环境删除干净,在/root目录下重新执行(或者在其他用户根目录下执行)
Unable to connect to the server: read tcp 192.168.47.128:40882->151.101.0.133:443: read: connection reset by peer