Question

How do I set DNS records for Kubernetes with a load balancer?

I am using Helm to create a Kubernetes deployment. In front of this, there is a load balancer and an ingress server - see below for an abridged version of helm status auth

==> v1/Service
NAME               TYPE          CLUSTER-IP      EXTERNAL-IP   PORT(S)       AGE
auth-mongodb       ClusterIP     10.245.186.209  <none>        27017/TCP     74s
auth-redis-master  ClusterIP     10.245.34.39    <none>        6379/TCP      74s
auth-redis-slave   ClusterIP     10.245.213.27   <none>        6379/TCP      74s
auth               LoadBalancer  10.245.82.177   46.101.65.69  80:32645/TCP  74s

==> v1beta1/Ingress
NAME  HOSTS                                  ADDRESS  PORTS  AGE
auth  auth.feature-deploy.example.com  80       74s

I’m happy enough with all this and it works great on DO. The only thing I can’t work out is how to update the DNS A record.

The domain name is managed on the DO control panel. If I manually set auth.feature-deploy.example.com and point to the load balancer, it all works fine. However, if I destroy/update the deployment, I’ll need to do this again manually.

Is there a way of getting Kubernetes to set a DNS A record that I’m missing, have I found an issue with the DO K8S stack or am I missing something?

Thanks

Ingress definition

# Source: auth/templates/ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: auth
  labels:
    app.kubernetes.io/name: auth
    helm.sh/chart: auth-0.1.0
    app.kubernetes.io/instance: auth
    app.kubernetes.io/managed-by: Tiller
spec:
  rules:
    - host: "auth.feature-deploy.example.com"
      http:
        paths:
          - path: /
            backend:
              serviceName: auth
              servicePort: http

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.

I’ve sort of moved away from this now. Rather than managing my own ingress, I’ve wired it up with GitLab and let them manage my ingress.

If I’d wanted to do this as my own ingress, I would need nginx-ingress controller on it’s own namespace that would then proxy to the individual service

just curious why you have a ingress here? i think you can do it with just Service of type LoadBalancer. if you were using a Service of type ClusterIP or NodePort then I think you would use ingress?

in any case the host in your INgress rules is not for actually going out and creating an A record, rather that is where you would put the value for the A record (created elsewhere somehow) such that the Ingress Controller could match on an incoming request by means of the HTTP Host: heador or TLS server name indication

but as to your original question I am not sure what if anything the DO kubernetes LoadBalancer does with DNS or if you are just given an externalIP and then you have to do the manual steps for the DNS zone wherever that may be hosted including DO.

Try DigitalOcean for free

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

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

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.