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.
CodePudding user response:
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.