<p>After trying kubernetes on a few KVMs with kubeadm, I'd like to setup a proper auto-scalable cluster on AWS with <a href="https://github.com/kubernetes/kops/" rel="nofollow noreferrer">kops</a> and serve a few websites with it.</p>

<p>The mind-blowing magic of <code>kops create cluster ...</code> gives me a bunch of ec2 instances, makes the k8s API available at <code>test-cluster.example.com</code> and even configures my local <code>~/.kube/config</code> so that I can <code>kubectl apply -f any-stuff.yaml</code> right away. This is just great!</p>

<p>I'm at the point when I can send my deployments to the cluster and configure the ingress rules – all this stuff is visible in the dashboard. However, at the moment it's not very clear how I can associate the nodes in my cluster with the domain names I've got.</p>

<p>In my small KVM k8s I simply install <a href="https://github.com/containous/traefik/" rel="nofollow noreferrer">traefik</a> and expose it on ports <code>:80</code> and <code>:443</code>. Then I go to my DNS settings and add a few A records, which point to the public IP(s) of my cluster node(s). In AWS, there is a dynamic set of VMs, some of which may go down when the cluster is not under heavy load. So It feels like I need to use an external load balancer given that my <a href="https://github.com/kubernetes/charts/tree/master/stable/traefik" rel="nofollow noreferrer">traefik helm chart</a> service exposes two random ports instead of fixed :80 and :443, but I'm not sure.</p>

<p>What are the options? What is their cost? What should go to DNS records in case if the domains are not controlled by AWS?</p>

<p>Configuring your service as a LoadBalancer service is not sufficient for your cluster to to setup the actual loadbalancer, you need an ingress controller running like the one above. </p>

<p>You should add the kops nginx ingress addon: <a href="https://github.com/kubernetes/kops/tree/master/addons/ingress-nginx" rel="nofollow noreferrer">https://github.com/kubernetes/kops/tree/master/addons/ingress-nginx</a></p>

<p>In this case the nginx ingress controller on AWS will find the ingress and create an AWS ELB for it. I am not sure of the cost, but its worth it.</p>

<p>You can also consider Node Ports which you can access against the node's public ips and node port (be sure to add a rule to your security group)</p>

<p>You can also consider the new AWS ELB v2 or ALB which supports Http/2 and websockets. You can use the alb-ingress-controller <a href="https://github.com/coreos/alb-ingress-controller" rel="nofollow noreferrer">https://github.com/coreos/alb-ingress-controller</a> for this.</p>

<p>Finally if you want SSL (which you should) consider the kube-lego project which will automate getting SSL certs for you. <a href="https://github.com/jetstack/kube-lego" rel="nofollow noreferrer">https://github.com/jetstack/kube-lego</a></p>
