-1

I have a controller using the kube crate that manages various worker resources (services/deployments). In those containers, I receive updates from the controller via a ConfigMap and make downstream requests to other Kubernetes services. As part of this, I do DNS queries, via the hickory-resolver crate, to resolve the IP of those down stream services. I'm concerned a bit about the DNS caching.

What event/resource do I need to subscribe to from the controller to initiate a dump the DNS cache in Hickory (it has a method off its resolver to do so)? Or am I over thinking this and the TTL will solve this for me?

1
  • 1
    I believe normal Services have stable cluster-internal IP addresses, which the cluster fills in .spec.clusterIP in the Service object, so if you're watching Services you can find out what names exist. There shouldn't be special DNS-caching considerations. Headless services might change their address sets more often (as member Pods come and go). Commented Jun 11 at 10:14

1 Answer 1

0

After some more research and chatting with ChatGPT, I learned about the EndpointSlice resources. These resources hold pages of the IP addresses (both v4/v6) for a given Service. Since I have the service names I require elsewhere, I can watch for EndpointSlice events and collect what I need. Additional benefits include:

  • They have zone and node metadata so I can make more local routing decisions.
  • They have distilled readiness checks and termination statuses, so I can filter before sending them out of my controller.

Overall, this is much more robust than DNS!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.