How does one point a domain to a Kubernetes cluster?

August 23, 2019 347 views
DigitalOcean Kubernetes

I understand how kubernetes ingresses work. I understand kubernetes services are used to expose one’s deployed service(s). What I don’t understand is how to get traffic into my cluster with a DigitalOcean managed Kubernetes.

3 Answers

Hi there!

Most commonly, people use services of type ‘LoadBalancer’ to get traffic into the clusters:

https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#configuration-file

Once a load balancer service is created our cloud controller manager that runs on your master will notice the new service is of type 'LoadBalancer’ and provision a DO load balancer to be pointed at your DOKS nodes at the NodePort specified or generated by the service. Now any traffic that hits your LB’s IP will be routed as follows(with a few exceptions):

User Request -> DO LB -> kubernetes node -> service -> pod

That LB will have an external-facing IP where you can point all you traffic that belongs to that service. Users often create their ingress controller service as the loadbalancer type and then use ingress rules to have the ingress controller distribute traffic. This prevents users from needing a individual LB for each service.

https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/

Regards,

John Kwiatkoski
Senior Developer Support Engineer

  • First off, thank you for your response this is helpful.

    So I don’t need to make an external load balancer first? Also how do I point a domain to an external DO load balancer?

No you do not need to create one first. The managed kubernetes logic will do that for you. Once it is created, you can check the LB’s IP that it was assigned(via kubectl or the DO cloud panel) and setup your domain to resolve to that LB IP.

Let me know if you have any additional questions.

Regards,

John Kwiatkoski
Senior Developer Support Engineer

[deleted]
  • Ok, I have things setup. I followed this tutorial, https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nginx-ingress-with-cert-manager-on-digitalocean-kubernetes, along with your articles. However the request is not getting to my pods. I can see that its getting to the load balancer, because ping will tell me the ip address. What I can’t seem to figure out is where its dropping off.

    I have the pods running.
    I have the services setup to so the cluster knows how to address the pods.
    I have the ingress setup to redirect the subdomains to the service to the pod…
    I have the internal nginx load balancer that is getting the traffic. Ping tells me…

    I don’t know where things are falling off at. I’m going to try the same config on my local cluster to see it I’m missing something.

Have another answer? Share your knowledge.