kubernetes群集初始化&使用主节点的公共IP地址加入
我正在研究分布式系统,尤其是Kubernetes群集。
但是,我只是在寻找使用Master的公共IP地址创建Kubernetes群集的解决方案。
我在堆栈溢出上读了很多文章,并搜索了谷歌搜索,但是找不到任何解决方案。
我想
- 使用Master的公共IP制作Kubernetes群集
为什么要使用Master的公共IP制作集群,因为我认为实际上可能有些情况:某些节点在集群网络接口的一面脱颖而出。 。
这意味着,有些工作的节点可能存在于具有主节点的同一私人网络中,而某些工作者节点则不存在。
我尝试了
很多方法,以至于
- control-plane-endpoint
选项初始化kubernetes cluster,kubeadm init -token abcdef.1234567890abcdef--token abcdef--token-ttl-token-ttl 0 - -token-ttl 0 - pod-network-cidr = 192.168.0.0/16 - control-plane-endpoint“ master_public_ip:6443”
这个解决方案让我加入群集,但在工人节点之后粘上,该节点存在同一个私人网络,加入,kubectl,kubectl,kubectl,kubectl卡住。
不仅问题,而且不能初始化存在于同一网络之外的工作人员节点的CNI POD。
--apiserver-cert-extra-sans
option when initialize kubernetes cluster,kubeadm init --token abcdef.1234567890abcdef --token-ttl 0 --pod-network-cidr=192.168.0.0 /16 - apiserver-cert-extra-sans master_public_ip- apiserver-advertise-address-address master_internal_ip
这个解决方案给我一些错误:
$ sudo kubeadm join 211.x.x.x:6443 --token 000000.0000000000000000 --discovery-token-unsafe-skip-ca-verification
[preflight] Running pre-flight checks
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
error execution phase preflight: unable to fetch the kubeadm-config ConfigMap: failed to get config map: Get "https://192.168.x.x:6443/api/v1/namespaces/kube-system/configmaps/kubeadm-config?timeout=10s": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
我想知道,我想与外部IP一起加入,但实际上是Kubernetes Preflight说,但是寻找主节点的内部IP,apiserver-partvertise-address。
也不适用于内部网络之外存在的工人节点。
- 因此,我尝试仅使用公共IP,
kubeadm Init ... - apiserver-advertise-address master_external_ip
。
这让工人加入集群,但无法通过CNI进行任何连接。 该工作节点的状态 也没有准备就绪
- 因此,从外部IP范围
我试图构建虚拟专用网络以使其留在同一内部网络中的虚拟专用网络,
。但是,当加入节点时,VPN被打破。我想,K8S也建立了自己的VPN,因此它们是矛盾的。
因此,问题
是否有任何解决方案来制作kubernetes群集,该集群允许在主网络范围之外存在的工人(例如:master:192.168.xx
,工人:172.16.xx )?
感谢您的帮助。
I'm studying about Distributed System, especially Kubernetes cluster.
However, I am just looking for solutions to creating Kubernetes cluster using master's public IP address.
I read so many articles on stack overflow and googled, however I couldn't find any solution.
What I am trying to do
- Making Kubernetes Cluster using Master's Public IP
Why I'm trying to make a Cluster using Master's Public IP, because I thought there are actually could be some cases that: Some nodes are exsiting out-side of Cluster's Network Interfaces.
It means, some worker nodes could be exist in same private network with master node, and some worker nodes are not.
What I have tried
I tried so many ways such that
--control-plane-endpoint
option when initialize kubernetes cluster,kubeadm init --token abcdef.1234567890abcdef --token-ttl 0 --pod-network-cidr=192.168.0.0/16 --control-plane-endpoint "MASTER_PUBLIC_IP:6443"
This solution let me join the cluster, but stucks after worker nodes, which exist same private network, joins, kubectl stucks.
Not only the problem but also cannot initialize CNI pods for worker nodes which exist outside of the same network.
--apiserver-cert-extra-sans
option when initialize kubernetes cluster,kubeadm init --token abcdef.1234567890abcdef --token-ttl 0 --pod-network-cidr=192.168.0.0/16 --apiserver-cert-extra-sans MASTER_PUBLIC_IP --apiserver-advertise-address MASTER_INTERNAL_IP
This solution give me some error follows:
$ sudo kubeadm join 211.x.x.x:6443 --token 000000.0000000000000000 --discovery-token-unsafe-skip-ca-verification
[preflight] Running pre-flight checks
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
error execution phase preflight: unable to fetch the kubeadm-config ConfigMap: failed to get config map: Get "https://192.168.x.x:6443/api/v1/namespaces/kube-system/configmaps/kubeadm-config?timeout=10s": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
Just I wonder, I tried to join with external ip, but actually kubernetes preflight said, looking for internal ip of master node, apiserver-advertise-address.
Also doesn't work for worker nodes which exist outside of internal network.
- So I tried to make just using PUBLIC IP,
kubeadm init ... --apiserver-advertise-address MASTER_EXTERNAL_IP
.
This one let the workers join the cluster, but cannot make any connection through CNI both internal worker nodes, external worker nodes. So the worker nodes' status which from External IP Range are Not Ready
- Even I tried to build Virtual Private Network for let them stay in same internal network.
However, when nodes are joined, the VPN is broken. I guess, also K8S build VPN its' own, so they are conflicting.
So, question is
Is there any solution to make Kubernetes Cluster that allows workers which exist outside of the master's network range (for example: master: 192.168.x.x
, workers: 172.16.x.x
) ?
Thank you for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
swapoff -a
未准备就绪。我将其设置在加入集群之前,但是,应该再次设置它。
即使工人重新启动,也应该再次这样做。
我不知道为什么。
NotReady solved by
swapoff -a
.I set it before joined the cluster, however, somehow it should be set once more.
Even when worker have rebooted, should do it once again.
I don't know why.