@@ -248,6 +248,11 @@ First, check the **External IP** of the load balancer:
...
@@ -248,6 +248,11 @@ First, check the **External IP** of the load balancer:
kubectl get service loadbalancer
kubectl get service loadbalancer
```
```
:bulb: Thanks to JSON output, you can get directly the IP address with the command:
```bash
kubectl get service loadbalancer -o=jsonpath='{.status.loadBalancer.ingress[0].ip}')
```
Then, write a shell script that sends some (at least 10) HTTP requests in a loop via `curl`.
Then, write a shell script that sends some (at least 10) HTTP requests in a loop via `curl`.
Run your script: it should show HTTP reponses from two different IP addresses. It might take some time to show output from both instances, as metallb is not a round-robin-style load balancer.
Run your script: it should show HTTP reponses from two different IP addresses. It might take some time to show output from both instances, as metallb is not a round-robin-style load balancer.
...
@@ -332,3 +337,30 @@ However it is possible to [set up an SSH "tunnel"](https://www.ssh.com/academy/s
...
@@ -332,3 +337,30 @@ However it is possible to [set up an SSH "tunnel"](https://www.ssh.com/academy/s
workstation$ kubectl get services
workstation$ kubectl get services
```
```
### Expose the loadbalancer's external IP address
As we have seen, with our cluster setup, the loadbalancer's external IP address is not routable outside the KinD host.
Without further complicating the MetalLB configuration, we can expose this address via the `socat` program,
which can do TCP-port forwarding.
1. Install `socat` on your remote KinD host:
```bash
kind$ apt install socat
```
1. Set up TCP-port-forwarding from the loadbalancer's external IP to the host's public IP:
```bash
kind$ LB_IP=$(kubectl get service loadbalancer -o=jsonpath='{.status.loadBalancer.ingress[0].ip}')