<p>Hi I am working on Google Cloud platform where I am not using GKE. Rather I am creating k8s cluster manually. Following is my setup,
Total 11 server</p>
<ol>
<li>Out of these 5 servers would be static servers and don't need any scaling</li>
<li>remaining 5 server would need up scaling if CPU or RAM consumption goes beyond certain
limit. i.e. I will spin only 3 servers initially and if CPU/RAM threshold is crossed then I will spin 2 more using Google Cloud Load balancer.</li>
<li>1 k8s Master server</li>
</ol>
<p>To implement this load balancer I have already created one Custom Image on which I have installed docker and kubernetes. Using this I have create one instance template and then instance group.</p>
<p>Now the problem statement is ,
Although I have created image with everything installed , When I am creating a instance group in which 3 VM are being created , these VMs does not automatically connect to my k8s master. Is there any way to automatically connect newly created VM as a node to k8s master so that I do not have run join command manually on each server ?</p>
<p>Thanks for the help in advance.</p>

TheAkashKamble
<blockquote>
<p>so that I do not have run join command manually on each server</p>
</blockquote>
<p>I am assuming that you can successfully run the join command to join the newly created VMs to the Kubernetes master manually. <br>
If that is the case, you can use the <code>startup-script</code> feature in the Google Compute Engine. <br>
Here is the documentation: <br>
<a href="https://cloud.google.com/compute/docs/instances/startup-scripts" rel="nofollow noreferrer">https://cloud.google.com/compute/docs/instances/startup-scripts</a> <br>
<a href="https://cloud.google.com/compute/docs/instances/startup-scripts/linux#passing-directly" rel="nofollow noreferrer">https://cloud.google.com/compute/docs/instances/startup-scripts/linux#passing-directly</a> <br> <br>
In short, <code>startup-script</code> is the feature from Google Compute Engine to automatically run our customized script during start-up.</p>
<p>And, the script could look something like this:</p>
<pre><code>#! /bin/bash
kubeadm join .......
</code></pre>
