Trying to get a basic setup working

February 8, 2019 475 views
Kubernetes

I am trying to get a fairly basic set up working wiht K8s:

  • simple UI host that serves up some HTML
  • NGinx in front of it that proxies to the simple UI host when a certain domain is hit

The result being that when I navigate to somedomain.com NGinx should proxy the request to the UI host.

I have deployed my UI host into the cluster and have also configured NGinx in the cluster

So - couple questions

Do I need a DO LB sat in front of all this? If i don’t need a load balancer where do I find the IP for the cluster to point the DNS at?

Do I need an nginx-ingress or is plain old nginx ok?

1 comment
  • Actually - configuring the NGinx to just respond with 200 I can’t get working:

    server {
            listen 80;
            server_name somedomain.com;
    
            location / {
                return 200 'gangnam style!';
            }
        }```
    
2 Answers

Disclaimer: I work at DigitalOcean on the managed Kubernetes offering.

Hey Wayne,

Do I need a DO LB sat in front of all this? If i don’t need a load balancer where do I find the IP for the cluster to point the DNS at?

Strictly speaking, you do not need a DO LB. However, one key advantage of using it is that it’d be robust towards node replacements. In general, you should not rely on IP addresses being fixed in the (any) cloud, especially not with Kubernetes where a cluster upgrade may replace some or all of your nodes. A DO LB set up through a Kubernetes Service gives you a layer of stability by not binding to IP addresses specifically.
You could also come up with a custom solution to manage Droplet IP addresses on your own with regards to load-balancing and external accessibility, but that’s an investment you’d have to make. You would find your Kubernetes worker node (droplet) IP addresses on your DigitalOcean cloud dashboard (the web UI).

Do I need an nginx-ingress or is plain old nginx ok?

nginx-ingress is vanilla Nginx combined with a so-called Ingress controller; that is, a little service that is able to process Kubernetes Ingress objects and provide external access to your Kubernetes applications. It does so by watching over changes made on Ingress objects and reconfiguring Nginx accordingly.

While you could use nginx-ingress (or another Ingress controller, like HAProxy’s, Envoy’s, or Traefik), it’s probably easier in your case to just run vanilla nginx and point external traffic at it. Again, a DO LB would be a viable option to accomplish the routing part.

Hope this helps!

Have another answer? Share your knowledge.