nirmata / kube-static-egress-ip

Kubernetes CRD to manage static egress IP addresses for workloads
Apache License 2.0
214 stars 38 forks source link

[WIP] HA gateway #18

Closed murali-reddy closed 5 years ago

murali-reddy commented 5 years ago

Refactor current code to support below:

murali-reddy commented 5 years ago

Gateway manager part is fully functional now. Please follow below step to try out.

On any kubernetes cluster with more than 3 nodes you can try below steps:

Now at this point static-egress-gateway-manager components performs following on any applied staticegressip custom resources

static-egress-gateway-manager itslef runs as HA mode with only one instance at a time actin as leader.

Please note that this steps only for testing logic to choose gateway for static egress IP and detect node failures and switch over to a different gateway.

For actual data-path configurations and routing changes to director and gateway you need to install kubectl apply -f https://raw.githubusercontent.com/nirmata/kube-static-egress-ip/ha/config/static-egressip-controller.yaml

murali-reddy commented 5 years ago

Updating instruction for testing end-to-end functionality:

At this point you can install a customeresource object. For e.g. please take a look at https://raw.githubusercontent.com/nirmata/kube-static-egress-ip/ha/config/static-egressip-example.yaml

you need to ensure service mentioned under service-name must exist.

Please note that this only works with direct-routing CNI's. For instance use Flannel with host-gw.

I am working making functionality work with overlay CNI's e.g. Flannel VXLAN and Weave.

uablrek commented 5 years ago

If kube-static-egress-ip is upgraded with a rolling-upgrade (but the nodes are not re-booted) then it would be horrible if the active gw hops to the next, and next node during the upgrade. When a new gw becomes active external traffic must be re-routed to it (how?) and all existing connections are lost.

Will is be possible to tune the leaderelection in a very "defensive" way. I.e wait for the active gw to come back rather than immediately move to another node?

murali-reddy commented 5 years ago

@uablrek thanks for taking interest in this project.

it would be horrible if the active gw hops to the next, and next node during the upgrade

Right now thinking (implementation in this PR) is to rely upon the kubelet + kube-controller-manager notion of node readiness. When a node acting as a gateway becomes unready, a new node is selected from the set of ready nodes.

murali-reddy commented 5 years ago

Merging PR. I will do follow-up PR to update the documentation.