Skip to content

Dynamic IP

In my home network I do not have a static IP. So I have to be able to update my domain names to point to my dynamic IP. This is necessary to be able to access the services of my cluster from outside my network.

Note

It is also necessary to set up forwarding rules to your router, to forward the requests to the cluster.

For the purpose I have created a docker image that is using my dns provider api to update my IP when it changes.

This image updates only the IPv4 address and the IPv6 I just have appended it manually.

TODO: In the future I should find a better solution to also udate the IPv6 automaticall Maybe replace the ddns functionality with https://github.com/mickybart/gandi-v5-rs?tab=readme-ov-file so we can have also dynamic IPv6 updates

Furthermore we are going to use external-dns to automatically update our dns.

Personal Access Token (PAT)

My dns provider is gandi and I need a token to be able to automatically update the dns records. This token has to be update frequently (depending on the settings of the token). So create a reminder for updating the token.

The token is created from the User Icon on the top right -> User Settings -> Personal Access Tokens (PAT) -> Create a token

I restricted only to the domains (products) that were of interest for me and I had to activate from the Domains section the Manage domain name technical configuration

Installation

kubectl create namespace general
kubectl -n general create secret generic gandi --from-literal=GANDI_PAT=GANDITOKEN
kubectl apply -f ddns-anagno-me.yaml
kubectl apply -f ddns-anagno-dev.yaml

helm repo add external-dns https://kubernetes-sigs.github.io/external-dns/ 
helm repo update
helm install external-dns external-dns/external-dns -f values.yaml --namespace general --version 1.21.1

kubect apply -f vpa.yml

kubectl apply -f whoami.yaml
# test that everything works
kubectl delete -f test.yaml

Note

Initially the prometheus monitoring should not be activate until we deploy the monitoring stack. Afterwards we can activate it.

Usefull commands

kubectl --namespace general logs -f -l "app=ddns"

Note

Take a look at: https://docs.k8s-at-home.com/guides/dyndns/#creating-a-secret

Resources

  • https://github.com/kubernetes-sigs/external-dns
  • https://github.com/kubernetes-sigs/external-dns/issues/1394#issuecomment-585228684
  • https://github.com/kubernetes-sigs/external-dns/tree/438d06f3c45cf66d08945ae18d17e29c540d5c96/charts/external-dns
  • https://grafana.com/grafana/dashboards/15038-external-dns/