"kubeadm init" 设置高可用集群失败
"kubeadm init" fails on setting up Highly Available clusters
我尝试为 Kubernetes 设置一个 haproxy'd 多主节点设置,如 [1] 中所述。我的网络配置是:
- haproxy = 192.168.1.213
- master0|1|2 = 192.168.1.210|211|212
- worker0|1|2 = 192.168.1.220|221|222(此时不感兴趣)
所有主机都能够相互连接(为每个节点解析 DNS)。每个节点都是 运行 Ubuntu 18.04.3 (LTS)。 Docker 安装为
- docker.io/bionic-updates,bionic-security,now 18.09.7-0ubuntu1~18.04.4 amd64 [已安装]
当前安装的 Kubernetes 包是
- kubeadm/kubernetes-xenial,现在 1.16.3-00 amd64 [已安装]
- kubectl/kubernetes-xenial,现在是 1.16.3-00 amd64 [已安装]
- kubelet/kubernetes-xenial,现在是 1.16.3-00 amd64 [已安装,自动]
- kubernetes-cni/kubernetes-xenial,现在 0.7.5-00 amd64 [已安装,自动]
使用 [2] 中描述的额外存储库(我知道我已经在我的 VM 上安装了 bionic
,但是可用的 "newest" 存储库仍然是 xenial
).
我的 haproxy 从 [3] 存储库安装为 haproxy/bionic,now 2.0.9-1ppa1~bionic amd64 [installed]
。
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
stats timeout 30s
user haproxy
group haproxy
daemon
defaults
log global
mode http
retries 2
timeout connect 3000ms
timeout client 5000ms
timeout server 5000ms
frontend kubernetes
bind *:6443
option tcplog
mode tcp
default_backend kubernetes-master-nodes
backend kubernetes-master-nodes
mode tcp
balance roundrobin
option tcp-check
server master0 192.168.1.210:6443 check fall 3 rise 2
server master1 192.168.1.211:6443 check fall 3 rise 2
server master2 192.168.1.212:6443 check fall 3 rise 2
在尝试设置我的第一个控制平面时,[4] 中描述的 运行 kubeadm init --control-plane-endpoint "haproxy.my.lan:6443" --upload-certs -v=6
导致此错误:
Error writing Crisocket information for the control-plane node
完全登录 [5]。如果我的 haproxy 配置有误,或者 docker 或 kubernetes 本身可能有问题,我会很迷茫。
我的 /etc/docker/daemon.json
看起来像这样:
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
- [1] https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/high-availability/
- [2] https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-using-native-package-management
- [3] https://launchpad.net/~vbernat/+archive/ubuntu/haproxy-2.0
- [4]https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/high-availability/#stacked-control-plane-and-etcd-nodes
- [5] https://pastebin.com/QD5mbiyN
虽然找不到合适的解决方案并在 github 的原始 "kubeadm" 项目中创建了一个问题,但请参阅此处:https://github.com/kubernetes/kubeadm/issues/1930。
由于问题中建议的 "triage" 对我来说不可行(Ubuntu 几乎 "set"),我最终设置了另一个 Docker 发行版,如此处所述:https://docs.docker.com/install/linux/docker-ce/ubuntu/,在开始新设置之前清除已安装的发行版。
虽然 运行 Docker(社区)v19.03.5
通过 kubeadm v1.16.3
抛出以下警告:
[WARNING SystemVerification]: this Docker version is not on the list of validated versions: 19.03.5. Latest validated version: 18.09
结果非常好,我按照原始文档中的描述成功设置了 ha 集群。
因此,这可以被视为解决方法,不是解决我原来问题的方法!
我尝试为 Kubernetes 设置一个 haproxy'd 多主节点设置,如 [1] 中所述。我的网络配置是:
- haproxy = 192.168.1.213
- master0|1|2 = 192.168.1.210|211|212
- worker0|1|2 = 192.168.1.220|221|222(此时不感兴趣)
所有主机都能够相互连接(为每个节点解析 DNS)。每个节点都是 运行 Ubuntu 18.04.3 (LTS)。 Docker 安装为
- docker.io/bionic-updates,bionic-security,now 18.09.7-0ubuntu1~18.04.4 amd64 [已安装]
当前安装的 Kubernetes 包是
- kubeadm/kubernetes-xenial,现在 1.16.3-00 amd64 [已安装]
- kubectl/kubernetes-xenial,现在是 1.16.3-00 amd64 [已安装]
- kubelet/kubernetes-xenial,现在是 1.16.3-00 amd64 [已安装,自动]
- kubernetes-cni/kubernetes-xenial,现在 0.7.5-00 amd64 [已安装,自动]
使用 [2] 中描述的额外存储库(我知道我已经在我的 VM 上安装了 bionic
,但是可用的 "newest" 存储库仍然是 xenial
).
我的 haproxy 从 [3] 存储库安装为 haproxy/bionic,now 2.0.9-1ppa1~bionic amd64 [installed]
。
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
stats timeout 30s
user haproxy
group haproxy
daemon
defaults
log global
mode http
retries 2
timeout connect 3000ms
timeout client 5000ms
timeout server 5000ms
frontend kubernetes
bind *:6443
option tcplog
mode tcp
default_backend kubernetes-master-nodes
backend kubernetes-master-nodes
mode tcp
balance roundrobin
option tcp-check
server master0 192.168.1.210:6443 check fall 3 rise 2
server master1 192.168.1.211:6443 check fall 3 rise 2
server master2 192.168.1.212:6443 check fall 3 rise 2
在尝试设置我的第一个控制平面时,[4] 中描述的 运行 kubeadm init --control-plane-endpoint "haproxy.my.lan:6443" --upload-certs -v=6
导致此错误:
Error writing Crisocket information for the control-plane node
完全登录 [5]。如果我的 haproxy 配置有误,或者 docker 或 kubernetes 本身可能有问题,我会很迷茫。
我的 /etc/docker/daemon.json
看起来像这样:
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
- [1] https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/high-availability/
- [2] https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-using-native-package-management
- [3] https://launchpad.net/~vbernat/+archive/ubuntu/haproxy-2.0
- [4]https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/high-availability/#stacked-control-plane-and-etcd-nodes
- [5] https://pastebin.com/QD5mbiyN
虽然找不到合适的解决方案并在 github 的原始 "kubeadm" 项目中创建了一个问题,但请参阅此处:https://github.com/kubernetes/kubeadm/issues/1930。
由于问题中建议的 "triage" 对我来说不可行(Ubuntu 几乎 "set"),我最终设置了另一个 Docker 发行版,如此处所述:https://docs.docker.com/install/linux/docker-ce/ubuntu/,在开始新设置之前清除已安装的发行版。
虽然 运行 Docker(社区)v19.03.5
通过 kubeadm v1.16.3
抛出以下警告:
[WARNING SystemVerification]: this Docker version is not on the list of validated versions: 19.03.5. Latest validated version: 18.09
结果非常好,我按照原始文档中的描述成功设置了 ha 集群。
因此,这可以被视为解决方法,不是解决我原来问题的方法!