I use Terraform to provision and manage a Kubernetes cluster on DigitalOcean. Specifically I use DigitalOcean Terraform provider.
It is pretty straight forward to create a cluster.
At the same time DigitalOcean suggests to manage Kubernetes’ Load Balancers with
kubectl. Meaning when I install ingress-nginx with
kubectl, DigitalOcean will automatically create a LoadBalancer. However that particular LoadBalancer is not defined in a terraform file. Meaning I cannot get it’s IP(for setting a DNS), scale it or delete it.
Another problem is, if I first create a LoadBalancer with terraform. I still need an Ingress Controller. Now I install ingress-nginx with
kubectl which will override the LoadBalancer previously created with terraform.
The question is: How to manage Kubernetes LoadBalancer with Terraform on DigitalOcean? Any examples or help is much appreciated.
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!
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.
There has been a similar issue raised on the official DigitalOcean Terraform provider repo here:
You can follow the example here:
Along with the changes from this PR here to get the IP address of the load balancer:
Hope that this helps.
This comment has been deleted
Want to learn more? Join the DigitalOcean Community!
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Sign up now