Add external node to GCP Kubernetes Cluster

10/7/2019

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.

-- Ishan Sanganeria
google-cloud-platform
kubernetes

2 Answers

10/8/2019

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.

-- Ishan Sanganeria
Source: StackOverflow

10/7/2019

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.

-- Crou
Source: StackOverflow