Handle local externalTrafficPolicy correctly #54
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
LoadBalancer services can specify an extra property called
externalTrafficPolicy
which defines how kube-proxy sets up the load balancing on the nodes. If such property is set toLocal
, kube-proxy will only forward traffic for externalIPs or LoadBalancer IPs to pods backing the service that are running on the node on which the packet arrived. If no pods are running on that node, that traffic gets dropped.This PR introduces a vrrp_script for services that set this property to
Local
which will healthcheck the Kubernetes provided health endpoint for the service. This endpoint returns 200 if at least a pod backing the service is running on the node, or 503 if no pods are running on the node. By adding this healthcheck script, keepalived will deem the node unhealthy if the healthcheck fails, thus ensuring the VIP moves to a different owner that does have at least a pod backing the service running on it. This way no traffic will be lost and theLocal
externalTrafficPolicy
will work as intended.This PR requires the keepalived image to contain the
/usr/bin/curl
binary which is used to perform the healthcheck.This PR should address and fix #13