Accessing a service using my own domain, without setting the ip in the nameserver

I have a grafana dashboard, an nginx-ingress and an OpenVPN service running in my cluster just fine, and I am able to reach everything I need using the cluster IP, but I want to use a domain name, lets say How can I achieve this?

This might be some usefull information:

My grafana service:

▶ k get svc --namespace monitoring
NAME                                               TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
doks-cluster-monitoring-grafana                    ClusterIP   <none>        80/TCP                       120m

My OpenVPN service:

▶ k get svc --namespace access    
openvpn   ClusterIP   <none>        1194/TCP   56m

My nginx-ingress:

▶ k get svc --namespace nginx-ingress
NAME                               TYPE           CLUSTER-IP       EXTERNAL-IP       PORT(S)                                     AGE
nginx-ingress-controller           LoadBalancer   80:31883/TCP,443:32254/TCP,1194:32021/TCP   48m
nginx-ingress-controller-metrics   ClusterIP    <none>            9913/TCP                                    48m
nginx-ingress-default-backend      ClusterIP   <none>            80/TCP                                      48m

My CoreDNS:

▶ k get svc --namespace kube-system  
NAME                                                 TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)                  AGE
kube-dns                                             ClusterIP   <none>        53/UDP,53/TCP,9153/TCP   143m

My /etc/resolv.conf:

▶ cat /etc/resolv.conf
# Generated by NetworkManager
search localdomain

My CoreDNS configmap:

▶ k describe cm --namespace kube-system coredns       
Name:         coredns
Namespace:    kube-system
Labels:       <none>
                {"apiVersion":"v1","data":{"Corefile":".:53 {\n    errors\n    health\n    ready\n    kubernetes cluster.local {\n  ...

.:53 {
    kubernetes cluster.local {
      pods insecure
    prometheus :9153
    forward . /etc/resolv.conf
    cache 30

Events:  <none>

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.

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.

Do you want this to just work locally on your machine? or globally? If locally, You could setup an /etc/hosts entry on your machine to manually resolve your hostname to the IP of the LB. Then configure ingress rules to route based on that hostname. If globally, do you already own your domain? If so, you would configure your domain’s DNS to resolve to the IP of the Loadbalancer, then ensure you have an ingress rule to appropriately route to your service based on the hostname you have chosen.