Question

Assign Kubernetes node to domain via Terraform

I have found the terraform module to create a domain to create a kubernetes cluster. I would like to assign the domain to a specific kubernetes node. Looking at the domain module, we see that this needs an ip, but the kubernetes cluster module does not export that. Consequently, I always have to assign the domain manually to the node (Networking > Domains > create A record that directs to the worker node). So my question, what am I missing to automate that step via terraform? Best, Mat


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
November 21, 2022

Hi there,

I believe that, usually, you would not point your domain name to a 1 specific Node directly, but have a service like a Load Balancer to which you would point your domain name to:

https://docs.digitalocean.com/products/kubernetes/how-to/add-load-balancers/

There was recently a similar question here on how to get the IP address of the load balancer:

https://www.digitalocean.com/community/questions/how-to-manage-kubernetes-loadbalancer-with-terraform

Hope that this helps!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up