2
votes

I have a kubernetes cluster on GCP which I created using the GCP dashboard. I created 3 default nodes in it.

Now, I want to add my laptop as a node to this cluster. I found that we can use kubeadm init for that but whenever I try that in my gcloud console (after logging in using gcloud container clusters get-credentials standard-cluster-1 --zone us-central1-a --project river-autumn-253318) it says that I have only 1 CPU.

Another problem is that the tutorials which I saw online always give out cluster IP as 192.x.x.x or 172.x.x.x after running kubeadm init, which, I understand are private IPs.

How can I add my laptop as a node to the GCP Kubernetes Cluster.

2
I have never considered doing this, but I guess you can. If you install docker, kubeadm and kubelet, then you run kubeadm join what happens?suren
I think you better provision a vm in gcp and install k8s using kubeadm and then try to join your laptop using the token returned by kubeadm.Bimal
@suren As I mentioned, I kubeadmin assumes the new node to be in the same network.Ishan Sanganeria

2 Answers

4
votes

I was able to solve the problem. All I had to do was add the flag --control-plane-endpoint.

My final token was something like kubeadm init --pod-network-cidr=10.240.0.0/16 --control-plane-endpoint=35.222.246.129

Thank you everyone fo their inputs.

1
votes

I'm almost certain that you create a cluster on GKE not GCP.

GCP - Google Cloud Platform, being a platform on which you can crate your virtual servers and configure them in a way you like. For example using kubeadm init to create a Kubernetes cluster.

GKE - Google Kubernetes Engine, is a cluster with Kubernetes pre-installed. You can change specs and number of nodes that are in the cluster.

So to answer your question, you will not be able to add your laptop to your current Kubernetes cluster (which is GKE).

You would need to create a new cluster and setup it up manually using for example kubeadm, you can follow this guide on how to Create a single control-plane cluster with kubeadm.

Once you have your new cluster ready you can add the laptop as a node using kubeadm join <control-plane-host>:<control-plane-port> --token <token> --discovery-token-ca-cert-hash sha256:<hash>. This command is provided to you at the end of the cluster installation when using kubeadm init.