While one can create and manage LoadBalancer/Ingress service from the kubernetes side, there are some limitation. One of the limitation seems that the ingress object created from kubernetes is only accessible within the same namespace. With the limited availability of floating ips, this is not very good. One can manually create the LoadBalncer object from the openstack, which does not impose such limitation.
- Note that if you want loadbalancer but without public floating ip, you can do it using a following annotation. Then it will use an internal ip.
- service.beta.kubernetes.io/openstack-internal-load-balancer: "true"
- service.beta.kubernetes.io/openstack-internal-load-balancer: "true"
1. LoadBalancer for SSH connection
Under "Network/Load Balancers", click "Create Load Balancer" button.
Fig. 1 : Create a LoadBalancer - Details |
---|
- GIve it a name, and select the subnet you are working with. Other fields do not need to be changed.
We will add a TCP listener for our SSH connection. You can add other listeners later.
- give it a sensible name. Select "TCP" protocol and port number of "22" for SSH connection.
- We also need to adjust the time out value.
- you need to define a pool to which the traffic will be forwarded.
- Give it name, select an load-balancing algorithm. I will select "SOURCE_IP", but it won't matter since we will have a single member for the SSH connection.
- add members to the pool. This is a list of ip that the traffic will be forwaded.
- We will add a single ip of the gateway instance we created.
- And set the port number properly (22 in this case).
- You don't need to worry about the weight values unless you want.
- We need to define a health monitor. I don't think this is required, but it seems it is when you create it from the gui.
- For TCP, I will just select "TCP" type (not sure what exactly they do)
- Everything is done. Click "Create" button.
- Waiting a few seconds, you will see that an ip is assigned to the LB object and its status turns to "Active".
...
We will now give it a floating ip so that it can be accessible from the external network.
- In the dropdown menu for the LB, there should be a menu for "associate floating ip", click it.
- Select the ip address you want to use. Then click "Associate" button.
...
In the LoadBalancer meny, click the LB you created.
Go to the "listener" tab to create a listener, and click "Create Listener".
- Give it a sensible name, and select "HTTP" protocol.
Next, we create a pool
- Give it a sensible name.
- We will select "ROUND_ROBIN" for the Algorithm. And a protocol of "HTTP".
- For the session persistence, we will select "HTTP_COOKIE".
...
We assume here that we have created a "NodePort" service, whose port number is 31349.
We add all the worker nodes as a member and set the port to 31349.
For the monitor, Select the type "HTTP". You can change other values if you know what they mean. Leaving it as is won't harm.
...