Im trying to set up a local cluster using VM and minikube, as Id been reading its only possible to use it for local purposes, but id like to join a secondary machine, and im searching a way to create the join and hash.
2 Answers
You can easily do it in case your minikube machine is using VirtualBox.
Start the minikube:
$ minikube start --vm-driver="virtualbox"
Check the versions of kubeadm, kubelet and kubectl in minikube and print join command:
$ kubectl version $ minikube ssh $ kubelet --version $ kubeadm token create --print-join-command
Create a new VM in VirtualBox. I've used Vagrant to create Ubuntu 16lts VM for this test. Check that the minikube and the new VM are in the same host-only VM network. You can use anything that suits you best, but the packages installation procedure would be different for different Linux distributions.
(On the new VM.) Add repository with Kubernetes:
$ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - $ cat <<EOF >/etc/apt/sources.list.d/kubernetes.list deb http://apt.kubernetes.io/ kubernetes-xenial main EOF $ apt-get update
(On the new VM.)Install the same version of kubelet kubeadm and other tools on the new VM (1.10.0 in my case)
$ apt-get -y install ebtables ethtool docker.io apt-transport-https kubelet=1.10.0-00 kubeadm=1.10.0-00
(On the new VM.)Use your join command from the step 2. IP address should be from the VM Host-Only-Network. Only having Nat networks didn't work well in my case.
$ kubeadm join 192.168.xx.yy:8443 --token asdfasf.laskjflakflsfla --discovery-token-ca-cert-hash sha256:shfkjshkfjhskjfskjdfhksfh...shdfk
(On the main host) Add network solution to the cluster:
$ kubectl apply -f https://docs.projectcalico.org/v3.0/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml
(On the main host) Check your nodes and pods using kubectl:
$ kubectl get nodes: NAME STATUS ROLES AGE VERSION minikube Ready master 1h v1.10.0 ubuntu-xenial Ready <none> 36m v1.10.0 $ kubectl get pods --all-namespaces -o wide NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE kube-system calico-etcd-982l8 1/1 Running 0 10m 10.0.2.15 minikube kube-system calico-kube-controllers-79dccdc4cc-66zxm 1/1 Running 0 10m 10.0.2.15 minikube kube-system calico-node-9sgt5 1/2 Running 13 10m 10.0.2.15 ubuntu-xenial kube-system calico-node-qtpg2 2/2 Running 0 10m 10.0.2.15 minikube kube-system etcd-minikube 1/1 Running 0 1h 10.0.2.15 minikube kube-system heapster-6hmhs 1/1 Running 0 1h 172.17.0.4 minikube kube-system influxdb-grafana-69s5s 2/2 Running 0 1h 172.17.0.5 minikube kube-system kube-addon-manager-minikube 1/1 Running 0 1h 10.0.2.15 minikube kube-system kube-apiserver-minikube 1/1 Running 0 1h 10.0.2.15 minikube kube-system kube-controller-manager-minikube 1/1 Running 0 1h 10.0.2.15 minikube kube-system kube-dns-86f4d74b45-tzc4r 3/3 Running 0 1h 172.17.0.2 minikube kube-system kube-proxy-vl5mq 1/1 Running 0 1h 10.0.2.15 minikube kube-system kube-proxy-xhv8s 1/1 Running 2 35m 10.0.2.15 ubuntu-xenial kube-system kube-scheduler-minikube 1/1 Running 0 1h 10.0.2.15 minikube kube-system kubernetes-dashboard-5498ccf677-7gf4j 1/1 Running 0 1h 172.17.0.3 minikube kube-system storage-provisioner 1/1 Running 0 1h 10.0.2.15 minikube

- 8,538
- 1
- 28
- 39
-
please share the vagrantfile – Abdennour TOUMI Nov 30 '18 at 01:10
-
why is the 'network solution" necessary? What does it do? Im concerned that its only for k8s 1.7. If its necessary for multi-node why is it not built into k8s? I read the yaml file and its a daemonset, etcd thing, a bunch of pods and a service. – Shorin Jan 18 '19 at 20:21
-
Network solution is required to communicate with pods on different node. It’s still required for the latest version of k8s. It is not built-in to k8s because there are more than one network addon exist. It’s up to you to decide which addon you want to use. 192.168.0.0/16 subnet is default for calico addon. If you want to use flannel you need to adjust its yaml file before applying it to the cluster. – VAS Jan 18 '19 at 20:55
-
I stuck at step6. https://stackoverflow.com/questions/55179194/can-join-the-cluster-but-unable-to-fetch-kubeadm-config – joe Mar 15 '19 at 10:40
This isn't possible with minikube. With minikube, the operating domain is a single laptop or local machine. You can't join an additional node, you'll need to build a whole cluster using something like kubeadm

- 12,422
- 5
- 57
- 67
-
1This probably was true back in 2018, but as of 2021 you can simulate multiple nodes of the cluster on one physical box using minikube. See `minikube node add` and other commands. https://minikube.sigs.k8s.io/docs/commands/node/#synopsis-1 – zuraff Aug 17 '21 at 08:00