Answers: <p>You can use the GCP <code>HTTP(S)</code> Load balancer. Since you are running a kubernetes cluster (Assuming you are using GKE), GKE uses Google compute VM instance groups which can be put behind a load balancer as target group.</p>
  
  <p>You can follow the below steps to setup a load balancer and put your kubernetes node behind a load balancer.</p>
  
  <ol>
  <li>Login to GCP console and go to <code>NETWORKING</code> > <code>Network Services</code> > <code>Load balancing</code></li>
  <li>Click on <code>Create Load Balancer</code> at the top of the page.</li>
  <li>Click on <code>Start Configuration</code> for <code>HTTP(s) Load balancing</code></li>
  <li>Select <code>From Internet to my VMs</code> if you want to access it from public internet and click <code>continue</code></li>
  <li>Give a <code>Name</code> to your load balancer</li>
  <li>Click on <code>Backend Configuration</code> and Select <code>Backend services</code> (from drop down) > <code>Create a backend service</code></li>
  <li>Give a name to backend service and select the other parameters appropriately. Select <code>Instance groups</code> in <code>Backend type</code>.</li>
  <li>In the <code>New backend</code> section, select the kubernetes instance group name from the drop down. After selecting the proper instance group, you can enter the ports which will accept the requests. You can modify other things if required. At the end, click <code>Create</code>.</li>
  <li>Next you can setup <code>Host and Path rules</code> if you need any.</li>
  <li>Next, you have to configure <code>Frontend configuration</code> which will be your frontend to accept the requests on the port and send it to the backend target group which we configured in the step 8.</li>
  <li>Once all the configurations are done, click on <code>Create</code> to create your load balancer.</li>
  </ol>
  
  <p>If everything was setup correctly, you should be able to access the contents from the load balancer endpoint.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-12-13T22:12:01.153Z
Answers: 2019-12-13T22:12:01.153Z
Answers: Samit
Body: <p>I'm creating a single node(name: node1) k8 cluster for demos. I have setup a nginx-ingress controller.</p>
  
  <pre><code>service/volted-marmot-nginx-ingress-controller        LoadBalancer   10.100.132.29   &lt;pending&gt;     80:30787/TCP,443:30043/TCP   3h48m
  </code></pre>
  
  <p>I can access it by node1_ip:30043 for e.g. How do I put a load balancer in front of it? What I want is to have loadbalancer_ip:443 point to node1_ip:30043. If that's the wrong way to think of it, please let me know. I can't do it anyway, as the target pool does not have any option to choose port(e.g. 30043) anyway.</p>
  
  <p>If I set the loadbalancer port to 300043 then loadbalancer_ip:300043 works but I was hoping to hide that.</p>
  
Tags: <kubernetes><load-balance><gcp>
Title: How to connect GCP Load balancer to Kubernetes cluster(single node cluster)
UserDisplayName: RAbraham
ThreadText: # How to connect GCP Load balancer to Kubernetes cluster(single node cluster)
  
  (Asked by: username_0 on 2019-12-12)
  
  I'm creating a single node(name: node1) k8 cluster for demos. I have setup a nginx-ingress controller.
  
  ```
  service/volted-marmot-nginx-ingress-controller        LoadBalancer   10.100.132.29   <pending>     80:30787/TCP,443:30043/TCP   3h48m
  
  ```
  
  I can access it by node1\_ip:30043 for e.g. How do I put a load balancer in front of it? What I want is to have loadbalancer\_ip:443 point to node1\_ip:30043. If that's the wrong way to think of it, please let me know. I can't do it anyway, as the target pool does not have any option to choose port(e.g. 30043) anyway.
  
  If I set the loadbalancer port to 300043 then loadbalancer\_ip:300043 works but I was hoping to hide that.
  
  **Tags:** kubernetes, load-balance, gcp
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-12-13. Score: 2 | Accepted answer
  
  You can use the GCP `HTTP(S)` Load balancer. Since you are running a kubernetes cluster (Assuming you are using GKE), GKE uses Google compute VM instance groups which can be put behind a load balancer as target group.
  
  You can follow the below steps to setup a load balancer and put your kubernetes node behind a load balancer.
  
  1. Login to GCP console and go to `NETWORKING` > `Network Services` > `Load balancing`
  2. Click on `Create Load Balancer` at the top of the page.
  3. Click on `Start Configuration` for `HTTP(s) Load balancing`
  4. Select `From Internet to my VMs` if you want to access it from public internet and click `continue`
  5. Give a `Name` to your load balancer
  6. Click on `Backend Configuration` and Select `Backend services` (from drop down) > `Create a backend service`
  7. Give a name to backend service and select the other parameters appropriately. Select `Instance groups` in `Backend type`.
  8. In the `New backend` section, select the kubernetes instance group name from the drop down. After selecting the proper instance group, you can enter the ports which will accept the requests. You can modify other things if required. At the end, click `Create`.
  9. Next you can setup `Host and Path rules` if you need any.
  10. Next, you have to configure `Frontend configuration` which will be your frontend to accept the requests on the port and send it to the backend target group which we configured in the step 8.
  11. Once all the configurations are done, click on `Create` to create your load balancer.
  
  If everything was setup correctly, you should be able to access the contents from the load balancer endpoint.
  
  
  ---
  
  