Report this

What is the reason for this report?

How do I update a DNS record automatically when deploying a loadbalancer from kubernetes?

Posted on February 4, 2021

I am deploying a loadbalancer with kubernetes. Once the loadbalancer is built I need to manually point the external IP address to the loadbalancers IP address. Is there any way I can automate this?

Here is my yaml file…

apiVersion: v1
kind: Service
metadata:
  name: joomla-service
  annotations:
    service.beta.kubernetes.io/do-loadbalancer-protocol: "http"
    service.beta.kubernetes.io/do-loadbalancer-algorithm: "round_robin"
    service.beta.kubernetes.io/do-loadbalancer-tls-ports: "443"
    service.beta.kubernetes.io/do-loadbalancer-certificate-id: "XXXXX-Lets-Encrypt"
    service.beta.kubernetes.io/do-loadbalancer-redirect-http-to-https: "true"
  labels:
    run: joomla
spec:
  type: LoadBalancer
  ports:
  - name: http
    port: 80
    targetPort: 80
    protocol: TCP
  - name: https
    port: 443
    targetPort: 80
    protocol: TCP
  selector:
    app: joomla

Thanks,

Chris Edwards



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.

I noticed a typo but cannot edit it…

Once the loadbalancer is built I need to manually point the external IP address to the proper DNS address.

Hi there,

You need to set up the LoadBalancer IP address manually as an A record for the domain.

Best Regards, Purnima Kumari

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.