<p>How to change ip when I run kubeadm init? I create master node on google compute engine and want to connect node from aws and azure, but kubeadm use internal ip address which see only from google cloud platform network. I tried to use --apiserver-advertise-address=external ip, but in this case kubeadm stuck in [init] This might take a minute or longer if the control plane images have to be pulled. Firewall are open.</p>

<p>If I understand correctly what you are trying to do is using a GCP instance running kubeadm as the master and two nodes located on two other clouds.</p>

<p>What you need for this to work is to have a working load balancer with external IP pointing to your instance and forwarding the TCP packets back and forth.</p>

<p>First I created a static external IP address for my instance:</p>

<pre><code> gcloud compute addresses create myexternalip --region us-east1
</code></pre>

<p>Then I created a a target pool for the LB and added the instance :</p>

<pre><code>gcloud compute target-pools create kubernetes --region us-east1
gcloud compute target-pools add-instances kubernetes --instances kubeadm --instances-zone us-east1-b
</code></pre>

<p>Add a forwarding rule serving on behalf of an external IP and port range that points to your target pool. You'll have to do this for the ports the nodes need to contact your kubeadm instance on. Use the external IP created before.</p>

<pre><code>gcloud compute forwarding-rules create kubernetes-forward --address myexternalip --region us-east1 --ports 22 --target-pool kubernetes
</code></pre>

<p>You can check now your forwarding rule which will look something like this:</p>

<pre><code>gcloud compute forwarding-rules describe kubernetes-forward
IPAddress: 35.196.X.X
IPProtocol: TCP
creationTimestamp: '2018-02-23T03:25:49.810-08:00'
description: ''
id: 'XXXXX'
kind: compute#forwardingRule
loadBalancingScheme: EXTERNAL
name: kubernetes-forward
portRange: 80-80
region: https://www.googleapis.com/compute/v1/projects/XXXX/regions/us-east1
selfLink: https://www.googleapis.com/compute/v1/projects/XXXXX/regions/us-east1/forwardingRules/kubernetes-forward
target: https://www.googleapis.com/compute/v1/projects/XXXXX/regions/us-east1/targetPools/kubernetes
</code></pre>

<p>Now you can go with the usual process to install kubeadm and set up your cluster in your instance <code>kubeadm init</code> took around 50 seconds on mine.</p>

<p>Afterwards if you got the ports correctly opened in your firewall and forwarded to your master the nodes from AWS and Azure should be able to join.</p>

<p>Congratulations, now you have a multicloud kubernetes cluster! :)</p>
