在腾讯云上执行
一直抛错
I0626 11:20:46.944977 213753 round_trippers.go:553] GET https://公网 IP:6443/healthz?timeout=10s in 4 milliseconds
I0626 11:20:46.944977 213753 round_trippers.go:553] GET https://公网 IP:6443/healthz?timeout=10s in 4 milliseconds
I0626 11:20:46.944977 213753 round_trippers.go:553] GET https://公网 IP:6443/healthz?timeout=10s in 4 milliseconds
I0626 11:20:46.944977 213753 round_trippers.go:553] GET https://公网 IP:6443/healthz?timeout=10s in 4 milliseconds
查看 kubelet 初始化日志,发现是无法找到 master 节点
[root@master docker]# journalctl -xeu kubelet
Jun 26 11:23:45 master kubelet[213849]: E0626 11:23:45.843456 213849 kubelet.go:2424] "Error getting node" err="node \"master\" not found"
Jun 26 11:23:45 master kubelet[213849]: E0626 11:23:45.939644 213849 event.go:276] Unable to write event: '&v1.Event{TypeMeta:v1.TypeMeta{Kind:"", API>Jun 26 11:23:45 master kubelet[213849]: E0626 11:23:45.943806 213849 kubelet.go:2424] "Error getting node" err="node \"master\" not found"
Jun 26 11:23:46 master kubelet[213849]: E0626 11:23:46.044283 213849 kubelet.go:2424] "Error getting node" err="node \"master\" not found"
Jun 26 11:23:46 master kubelet[213849]: E0626 11:23:46.145039 213849 kubelet.go:2424] "Error getting node" err="node \"master\" not found"
Jun 26 11:23:46 master kubelet[213849]: E0626 11:23:46.245805 213849 kubelet.go:2424] "Error getting node" err="node \"master\" not found"
Jun 26 11:23:46 master kubelet[213849]: E0626 11:23:46.335784 213849 controller.go:144] failed to ensure lease exists, will retry in 7s, error: Get "h>Jun 26 11:23:46 master kubelet[213849]: E0626 11:23:46.346915 213849 kubelet.go:2424] "Error getting node" err="node \"master\" not found"
Jun 26 11:23:46 master kubelet[213849]: E0626 11:23:46.447024 213849 kubelet.go:2424] "Error getting node" err="node \"master\" not found"
Jun 26 11:23:46 master kubelet[213849]: I0626 11:23:46.468192 213849 kubelet_node_status.go:70] "Attempting to register node" node="master"
Jun 26 11:23:46 master kubelet[213849]: E0626 11:23:46.472694 213849 kubelet_node_status.go:92] "Unable to register node with API server" err="Post \">Jun 26 11:23:46 master kubelet[213849]: E0626 11:23:46.547873 213849 kubelet.go:2424] "Error getting node" err="node \"master\" not found"
master 是我本机的 hostname, /etc/hosts 也改成 master 指向公网 IP 了。 请问下大家是出了什么问题?
命令
kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-cert-extra-sans=公网IP --apiserver-advertise-address=公网IP--image-repository=registry.aliyuncs.com/google_containers
1
Nitroethane 2022-06-26 12:09:25 +08:00 via iPhone
6443 端口是 apiserver 端口,健康检查失败说明 apiserver 没起来,看看 apiserver pod 的日志
|
2
patrickyoung 2022-06-26 13:15:55 +08:00 via iPhone
执行啥,掉字了。
然后 就我踩了大概一个月左右的坑的经验,k8s 官方文档里面 troubleshooting kubeadm 页面的东西能解决你 99.99%的问题。剩下 0.01%是网络环境的问题。 |
3
server 2022-06-26 14:10:58 +08:00
如果是用 可以找 kubeKey sealos 这些工具, 如果是从头开始折腾 k8s 怎么开心怎么来.
|
4
Judoon 2022-06-26 15:14:24 +08:00
公网 ip 是弹性绑定的还是直接配置到机器上某个网卡的,--apiserver-advertise-address 是不是只能使用本机的 ip ?
如果公网 ip 是弹性绑定的,应该会不行 |
5
Beebird 2022-06-26 16:10:32 +08:00
node 访问 apiserver 超时。可能是防火墙问题,试试把公网 IP 换成内网 IP 。另外用公网 IP 也不安全,集群间通信也会慢。
|
6
ChevalierLxc OP @Judoon 我换成内网 IP 后,
kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-cert-extra-sans=10.0.16.11 --apiserver-advertise-address=10.0.16.11 --image-repository=registry.aliyuncs.com/google_containers The connection to the server 10.0.16.11:6443 was refused 我的 apiserver 一直没启动吗?我确实没有手动启动 apiserver |
7
Judoon 2022-06-26 19:23:54 +08:00
@ChevalierLxc docker ps 看看 apiserver 的容器有没有?然后看看监听的端口有没有?然后手动 curl 试试?再看看防火墙?
怎么感觉一点排查问题能力都没啊 |