How can a k8s service connected to an external endpoints object remove addresses that are no longer alive?

11/24/2016

I have a service created as a headless service that is intended to map to a range of external IP addresses provided by a separate k8s endpoints object. If one of the external nodes were to die, is there any way for me to remove the specific endpoint from the service automatically?

-- jeremyong
kubernetes

2 Answers

11/24/2016

I'm thinking of deploying simple haproxy pods with configuration taken either from configmap (list of IPs) or directly from the other external service, to be able to add healthchecks. Config change might also be automated by confd inside this haproxy container. And these haproxy pods would be exposed as a Service in Kubernetes to the other apps.

-- Jakub GÅ‚azik
Source: StackOverflow

11/24/2016

You can use kubectl patch to edit whatever object you want.

Since it's an external IP and Kubernetes is therefore not aware of it, you will need to provide the mechanism to automate the deletion, like using a job you run periodically or some sort of callback.

-- MrE
Source: StackOverflow