Feature request: Kubernetes API & external-dns as a provider #96

Open
opened 2025-11-20 04:20:10 -05:00 by saavagebueno · 6 comments
Owner

Originally created by @MOZGIII on GitHub (Feb 2, 2021).

Originally assigned to: @qdm12 on GitHub.

  1. What's the feature?

Teach ddns-updater to update the external-dns records in the Kubernetes API (via CRDs).

  1. Extra information?

To do. Just posting the idea here for now, will get back to it and fill it in if there are enough 👍 .

Originally created by @MOZGIII on GitHub (Feb 2, 2021). Originally assigned to: @qdm12 on GitHub. 1. What's the feature? Teach `ddns-updater` to update the [external-dns](https://github.com/kubernetes-sigs/external-dns) records in the Kubernetes API (via CRDs). 2. Extra information? <!-- YOU CAN CHAT THERE EVENTUALLY: https://github.com/qdm12/ddns-updater/discussions --> To do. Just posting the idea here for now, will get back to it and fill it in if there are enough 👍 .
Author
Owner

@fredericrous commented on GitHub (Feb 7, 2021):

Hi @MOZGIII, could you expand on this and explain the use case?

@fredericrous commented on GitHub (Feb 7, 2021): Hi @MOZGIII, could you expand on this and explain the use case?
Author
Owner

@MOZGIII commented on GitHub (Feb 8, 2021):

I have a Kubernetes cluster at home that can manage the DNS via an external DNS provider.
I'd like my cluster to also be in charge of updating the dynamic IP address through the same pipeline. There is a number of benefits to this: Kubernetes can be made aware of the IP address of its gateway, enabling some more advanced workflows.

Given it some thought, I am realizing that full-featured Kubernetes integration is probably not a good fit for this codebase - it has other concerns that should remain primary. However, it is possible to build a separate app to manage the Kubernetes state, that would accept simple HTTP requests from the ddns-updater, and take care of the external-dns state and other Kubernetes-related maintenance.

So, the initial flow I had in mind was ddns-updater (with direct support) -> kube-apiserver -> external-dns, but now I'm thinking about ddns-updater (as is) -> dynamic-dns-operator (a new thing) -> kube-apiserver -> external-dns.

@MOZGIII commented on GitHub (Feb 8, 2021): I have a Kubernetes cluster at home that can manage the DNS via an [external DNS provider](https://github.com/kubernetes-sigs/external-dns). I'd like my cluster to also be in charge of updating the dynamic IP address through the same pipeline. There is a number of benefits to this: Kubernetes can be made aware of the IP address of its gateway, enabling some more advanced workflows. Given it some thought, I am realizing that full-featured Kubernetes integration is probably not a good fit for this codebase - it has other concerns that should remain primary. However, it is possible to build a separate app to manage the Kubernetes state, that would accept simple HTTP requests from the `ddns-updater`, and take care of the `external-dns` state and other Kubernetes-related maintenance. So, the initial flow I had in mind was `ddns-updater` (with direct support) -> `kube-apiserver` -> `external-dns`, but now I'm thinking about `ddns-updater` (as is) -> `dynamic-dns-operator` (a new thing) -> `kube-apiserver` -> `external-dns`.
Author
Owner

@fredericrous commented on GitHub (Feb 8, 2021):

Is there an api endpoint that can be used to update the IP or do we have to generate a Kubernetes spec to do that? Looking at the doc, an endpoint might exist, but Kubernetes doc is a real labyrinth, I didn't find this info.
If the solution relies on just calling an API, no need to create an external package. If the solution is to generate a spec, indeed creating a micro program, that communicates with ddns-updater, makes sense.

@fredericrous commented on GitHub (Feb 8, 2021): Is there an api endpoint that can be used to update the IP or do we have to generate a Kubernetes spec to do that? Looking at the doc, an endpoint might exist, but Kubernetes doc is a real labyrinth, I didn't find this info. If the solution relies on just calling an API, no need to create an external package. If the solution is to generate a spec, indeed creating a micro program, that communicates with ddns-updater, makes sense.
Author
Owner

@MOZGIII commented on GitHub (Feb 8, 2021):

Since this project uses Go, I don't think generating a spec is a way to talk to Kubernetes, but rather using its own client.

Take a look here for the CRD type: https://github.com/kubernetes-sigs/external-dns/blob/master/endpoint/endpoint.go
We can also implement the connector source: https://github.com/kubernetes-sigs/external-dns/blob/master/source/connector.go

@MOZGIII commented on GitHub (Feb 8, 2021): Since this project uses Go, I don't think generating a spec is a way to talk to Kubernetes, but rather using its own client. Take a look here for the CRD type: https://github.com/kubernetes-sigs/external-dns/blob/master/endpoint/endpoint.go We can also implement the connector source: https://github.com/kubernetes-sigs/external-dns/blob/master/source/connector.go
Author
Owner

@fredericrous commented on GitHub (Feb 9, 2021):

taking inspiration on external-dns might be the optimal path indeed. But it might be simpler to use the go client instead. There is an example here https://github.com/kubernetes/client-go/blob/master/examples/in-cluster-client-configuration/main.go
And there is a Open API spec: https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/openapi-spec/swagger.json The endpoint to set the IP seems to be io.k8s.api.core.v1.ServiceSpec

@fredericrous commented on GitHub (Feb 9, 2021): taking inspiration on external-dns might be the optimal path indeed. But it might be simpler to use the go client instead. There is an example here https://github.com/kubernetes/client-go/blob/master/examples/in-cluster-client-configuration/main.go And there is a Open API spec: https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/openapi-spec/swagger.json The endpoint to set the IP seems to be io.k8s.api.core.v1.ServiceSpec
Author
Owner

@MOZGIII commented on GitHub (Feb 9, 2021):

I don't think you'd actually want to alter Services (I wouldn't in my use case). I'm using a custom CRD provided by the external-dns project - the one that actually manages the DNS records at the remote DNS provider. Service has some IPs we can set too, but they're not a good fit for these kinds of updates.

@MOZGIII commented on GitHub (Feb 9, 2021): I don't think you'd actually want to alter `Service`s (I wouldn't in my use case). I'm using a custom CRD provided by the `external-dns` project - the one that actually manages the DNS records at the remote DNS provider. `Service` has some IPs we can set too, but they're not a good fit for these kinds of updates.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ddns-updater#96